mix
mix

Reputation: 7151

why would a userscript wrapped in a firefox addon be slower than the same script in greasemonkey?

I've been working on converting a Greasemonkey userscript into a Firefox addon. I'm using the page-mod module and it appears to work as expected.

EXCEPT that it is noticeably slower!

The first action that is slower is the load of the script. Even though I've set my contentScriptWhen to ready, the xpi version (which, among other things inserts a checkbox for toggling its actions) takes much longer to load and show its checkbox.

The second action that is slower is its toggle action. The affect of the toggle takes noticeably longer to execute.

The script is long and involved so I haven't included it here. But in general, it uses jQuery (pasted into the referenced contentScriptFile) to make a number of modifications to the page. Those mods are turned on and off by the aforementioned toggle.

Can anyone think of general reasons why the same userscript, when loaded via an XPI addon, would be considerably and noticeably slower than that same script is when loaded via Greasemonkey?

Upvotes: 3

Views: 289

Answers (1)

erikvold
erikvold

Reputation: 16558

Page-mods are UserScripts are implemented differently, the former is more all proxified and more secure, but also slower in some cases. The better written your page-mod is the more it will benefit.

Upvotes: -1

Related Questions