FAQ: What are the performance benefits over using GM?

drhouse edited this page Feb 5, 2013 · 32 revisions

This is a list of performance gains of Scriptish over Greasemonkey.


  1. JavaScript Modules (JSM): There is only one instance of each helper object, which is shared between all windows. This means Scriptish only loads code once, and only when needed. Compare this behavior to Greasemonkey, which creates a helper object instance for an XPCOM component, and then again for each window.
  2. Error Handling: The code behind error handling has been greatly simplified.
  3. API Refinements: Various refinements have been made to the GM_ API. For example, GM_registerMenuCommand no longer attempts to run against iframes.
  4. Asynchronous file operations: Scriptish writes the config and blocklist files asynchronously (i.e. off of the main thread), unlike Greasemonkey. Scriptish also reads modified scripts asynchronously, improving browser responsiveness.
  5. Config stored as JSON: JSON is faster to parse and create than XML, which is what Greasemonkey uses.
  6. No Add-ons Manager Proxy Scripts: Scriptish uses one array of scripts, which is shared with the Add-ons Manager. Greasemonkey, on the other hand, keeps an extra array of proxy scripts for the Add-ons Manager, requiring extra work to ensure the proxy objects are updated when a script is updated and vice versa.
  7. Goodbye Old Browsers: Code supporting old versions of Firefox (i.e. before Firefox 4) has been removed. By simplifying the code base, performance gains have been achieved.
  8. Toolbar Button: Greasemonkey listens to every DOMNodeInserted or DOMNodeRemoved on every browser window in order to support its toolbar button. Scriptish does not require such listeners due to its superior toolbar button implementation.
  9. "Enabled" Checking: Greasemonkey checks the value of its "enabled" preference whenever a page loads. Scriptish, however, caches its "enabled" value, avoiding unnecessary lookups.

Script Loading

  1. Reduced, merged & cached @include/@exclude regular expressions (instead of being simply memoizing them, which GM does).
  2. Script contents are cached in memory after first use, greatly reducing the time required to inject user scripts. This approach increases memory usage, and is therefore optional (see Manual: Preferences).
  3. GM_ API resources are not created until they are needed.
  4. User scripts are not wrapped by default.
  5. The code to utilize the Firebug console has been greatly reduced.
  6. Scripts have greater control over when they load through the use of the advanced @run-at and @delay metadata block headers.

Startup Performance

  1. Scriptish does not use a start-up listener. Greasemonkey, however, utilizes a start-up listener which has to load an instance of each of its XPCOM component helpers.
  2. Conditional logic for Greasemonkey version changes has been removed.

Add-ons Manager

  1. Greasemonkey provides a "sort by execution order" option. In order to support this sorting feature they must execute a good deal of code to add menu items, add the sort by option, and perform various other tasks which are unnecessary in Scriptish.