= Optimisation = There are many things which can be done to optimise the performance, so of them will be minor and some of them may require larger changes. The two goals are: * Faster * Less Bandwidth (smaller pages and/or more caching) == 1) Develop Automated Performance Metrics == Before Sahana Eden can be effectively optimised, we need a set of performance metrics to optimise to. Metrics should: * Test as wide as wide a variety of the code as possible. * Be able to be automatically tested (''See:'' DeveloperGuidelinesTesting). * Cover different usage scenarios * Low bandwidth * High number of users The Automated Performance Metrics, will also allow us to better share performance statistics of Sahana Eden. Can test out the performance of different !JavaScript options to achieve a task using: * http://jsperf.com == 2) Make Enhancements to Sahana Eden == Once the metrics have been developed enhancements can be made to improve these. These enhancements include: * Using Profiler Tools to identify parts of the code which require more computation (http://eden.sahanafoundation.org/wiki/DeveloperGuidelinesOptimisation#Profiling). * Avoid excess DB calls, Use web2py's {{{cache}}} instead * Move as much JS to static files as possible * Investigate whether we should reduce the size of some of our fields (e.g. to fit query rows into the 4Kb pagesize) * Investigate whether it is better to only T() strings once per request at the expense of additional global vars * Investigate the possibility of loading large page components using AJAX (although this should only be for subsequent pages as there is a per-request overhead) * S3XML's gis_encode(): Remove the Public URL to keep filesize small when loading off same server (GeoJSON &layer=xx) * KML Stylesheet: Don't repeat the IconStyle for every record if they have the same marker (tuids?) * Download/execute scripts asynchronously: * We currently use [http://yepnopejs.com yepnope.js] in the Map, but we should investigate using it more widely * Google JS is excluded as they use document.write * Can be extended to work with Modernizr * Author [http://www.quora.com/What-are-the-use-cases-for-RequireJS-vs-Yepnope-vs-LABjs doesn't recommend] using this for complicated sites! (instead suggests RequireJS) * Alternatives: * [http://headjs.com HeadJS] - includes CSS polyfills for older browsers, includes a head.ready(), has scope issues * [http://labjs.com LabJS] - supposed to be the fastest, has scope issues * [http://requirejs.org RequireJS] - handles dependencies well, more complex setup, order! is a plugin, has scope issues * Comparions: * http://webification.com/12-javascript-loaders-to-speed-up-your-web-applications * https://spreadsheets.google.com/spreadsheet/lv?key=0Aqln2akPWiMIdERkY3J2OXdOUVJDTkNSQ2ZsV3hoWVE&f=true&noheader=true&gid=2 ''See Also:'' * DeveloperGuidelinesOptimisation