Code improvements, slight performance improvements

Tonight has been a productive night. I have started on some of the code optimisations that i’ve been waiting since September to get around to!

Some of it has been about reducing and reusing code, for consistency and for ease of writing and maintaining the codebase. Some of it has been about optimising to reduce the amount of HTML and JavaScript that gets sent to your browser - this makes page refreshes faster.

One major leap forward today is the introduction of Low Pro, a technique for taking out inline JavaScript and putting it into separate files. It’s something i learnt about at RailsConf, and i’ve been wanting to put it into MyChores ever since. It’s really good for making the same page work with or without JavaScript, meaning we can soon get rid of the “Enable JavaScript” option in the preferences. Instead of explicitly attaching an AJAX post and a Scriptaculous fade effect to every task, a single snippet of code dynamically attaches itself to the tasks.

Despite the reduction in code, page loads are still a bit slow. I want to optimise the database queries so that fetching your tasks happens faster for the initial page load. Once the page is loaded you should find that ticking off your tasks feels a bit more responsive.

Please let me know if you see anything broken after tonight’s changes. You should find that everything works just the same, although i did put in a few subtle enhancements … i wonder if anyone will notice! :)

Leave a Reply