Open Bug 1133470 Opened 10 years ago Updated 2 months ago

elliptic.js gets slower benchmark results on nightly than on stable

Categories

(Core :: JavaScript Engine, defect)

38 Branch
x86
macOS
defect

Tracking

()

People

(Reporter: fedor.indutny, Unassigned)

Details

(Keywords: perf)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36 Steps to reproduce: I just wrote a benchmark to compare my library elliptic.js to emscripten version of libsecp256k1 : http://jsperf.com/jsbn-vs-sjcl-ecc/24 . Actual results: When running it I found that first of all "native" javascript code was much slower than in Chrome (which is sad, but kind of "ok"), and second - "native" javascript code became slower in the Firefox Nightly Expected results: I hope for best, for sure :) It would be great if elliptic.js would run at the same speed as it does in chrome. Nevertheless, making it's performance not downgrade in nightly would be great too.
Adding Jan as he might be interested.
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Version: Firefox 38 → 38 Branch
(In reply to Andy Wingo [:wingo] from comment #1) > Adding Jan as he might be interested. Definitely. I'll investigate in a bit.
Flags: needinfo?(jdemooij)
Attached file Shell test
I get about 1100-1200 ms in the shell, ~800 with V8 (both 32-bit). We spend a lot of time constructing arrays here: t.words = new Array(this.length + e.length) I think because we don't know the argument is int32. Changing that to (this.length + e.length)|0 helps a bit; we should make MNewArrayDynamicLength more robust. After that we're still slower; probably less efficient JIT code somewhere. Have to dig more.
Status: UNCONFIRMED → NEW
Ever confirmed: true
If it helps - bn.js heavily relies on 26bit * 26bit multiplication. This is usually resulting in using `double` type with 52bit integer value in it. I don't know exact place where the slowdown happens, but the `.mulTo` function is the most heavily used one on v8.
Keywords: perf
There are a few things we should improve here, for instance Ion should inline prototype gets based on Baseline feedback. We currently only do that for own properties. It's on my list but I have some other perf issues to fix first.
Clearing needinfo for now. It's on my list.
Flags: needinfo?(jdemooij)
Severity: normal → S3

Nightly: https://share.firefox.dev/4dWuOLM (440ms without hte profiler)
Chrome: https://share.firefox.dev/3XxeueJ (300ms without the profiler)

Should this bug be closed?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: