Performance/Addons/BestPractices
A list of recommendations for add-on authors to help keep Firefox fast and responsive.
Once it matures, we'll move it over to MDC. Please contribute your tips!
Use JavaScript Modules
Instead of the <script> tag in overlays JavaScript that is loaded via the script tag can slow window load. If your script is not needed as part of window setup, and doesn't need to be loaded for each individual window, then load it on-demand as a module.
Instead of JS XPCOM services JavaScript code modules are singletons, are fastloaded, and don't require XPCOM like a full-blown JS XPCOM service does.
Avoid mozIJSSubScriptLoader Scripts imported this way do not use fastload and are loaded and evaluated from the original source every time loadSubScript is called. Convert any uses to proper modules if possible.
Memoization
Lazily Load Services
Reduce File I/O
- Use JARs!
- Combine CSS
- Combine pref files
- Combine interfaces into a single .idl to reduce xpt files