Closed Bug 913182 Opened 11 years ago Closed 2 years ago

Javascript performance in extension worse than on "normal" webpage?

Categories

(Core :: JavaScript Engine, defect)

23 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mvo, Unassigned, NeedInfo)

References

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130807180628

Steps to reproduce:

I use a pure JS implementation of the sha512crypt algorithm (from https://github.com/mvo5/sha512crypt-node) in a the firefox extension "PassHash" (https://github.com/mvo5/passhash). It appears that the runtime of the same sha512crypt() code is 10x slower than when its run in a normal web-page.


Actual results:

When I run the sha512crypt code in a test webpage like this:
"""
var start = Date.now();
console.log(sha512crypt("pass", "salt"));
console.log("time: " + (Date.now() - start));
"""
I get a "time" of ~220ms which is just fine.

When I run the same function in my extension (tested in a fresh profile) it takes 2588ms which looks odd. Fwiw, the key javascript.options.baselinejit.chrome is set to true.


Expected results:

I expected similar performance both in normal cases. Any help is appreciated and I'm happy to provide more test cases.
Dupe Bug 911570 ?
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Or bug 776798.  Or a separate problem.  It's hard to say without seeing exactly how the code is invoked.
Depends on: 776798, 911570
If this is being run somewhere in chrome, your issue is likely that chrome doesn't use IonMonkey or type inference yet, just the Baseline Compiler. They're pending to be switched on for chrome in bug 911970. Nightlies should now have separate javascript.options.ion.chrome & javascript.options.typeinference.chrome prefs you can now switch on to test. (from bug 907201)
Thanks Dave! I downloaded the latest nightly [1] and set "javascript.options.typeinference.chrome" and "javascript.options.ion.chrome" both to "true" (the default was "false" for the nightly).

Especially the former (typeinference) improved performance quite a bit, but I still get ~1400ms in my extension compared to 140ms-200ms in my "normal" web page for the same function. Is my nightly not recent enough or are there more options that need to get switched?

Thanks,
 Michael


[1] $ md5sum ../firefox-26.0a1.en-US.linux-x86_64.tar.bz2
ebf56143de1ec1ec950488deffa17624  ../firefox-26.0a1.en-US.linux-x86_64.tar.bz2
Would you mind testing with the latest Nightly and see if the issue persists?
Flags: needinfo?(mvo)
See Also: → 916464
Assignee: general → nobody
This should be much better with the latest Nightly. Would you mind retesting this?
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.