CryptoCat Firefox add-on insufferably slow at generating keys

Gordon M's Avatar

Gordon M

02 May, 2014 12:29 AM

Hey, just a suggestion more than any expectation of support, but looking at CryptoCat's Firefox add-on might be a good way to do some tuning on your Javascript engine. It takes 10-20 min on the "generating crypto keys" step with the progress bar at 100% on a 1.25GHz G4e (PPC 7450), but DOES eventually work after that. Maybe there is something that can be improved? I've generated huge RSA and other keys on the same machine (not in Javascript), and run thousands of iterations of PBKDF2 (in Javascript) with nowhere near that kind of CPU-bound load.

  1. Support Staff 1 Posted by Cameron Kaiser on 02 May, 2014 12:33 AM

    Cameron Kaiser's Avatar

    It's nothing specific about CryptoCat; it's really anything that does heavy math in JavaScript. PPCBC is decent at integer math but has really inefficient floating point code. The old JaegerMonkey could beat it by several times even with its latency penalty, but we can't use that anymore. You can get an idea by comparing V8 Crypto in 17 and 24.

    The definitive solution is to finish the IonMonkey implementation, which generates substantially better floating point JIT code, and unfortunately that's on the back burner until 31 is ready.

  2. Support Staff 2 Posted by Cameron Kaiser on 02 May, 2014 12:34 AM

    Cameron Kaiser's Avatar

    (Btw, as an "It could be worse" datapoint, try it without any JIT at all. You'll give up.)

  3. 3 Posted by Gordon M on 02 May, 2014 12:41 AM

    Gordon M's Avatar

    Okay, cool. It's good to know that it's a known issue, even if it's a back-burnered one. I guess they're doing some kind of ECC or something which requires float? Anyway, thanks for the near-instantaneous response. I tweeted at the Tigerbrew maintainer and the CryptoCat people so maybe they will comment.


  4. Support Staff 4 Posted by Cameron Kaiser on 02 May, 2014 12:44 AM

    Cameron Kaiser's Avatar

    It would probably be very difficult for them to avoid float with numbers requiring a certain level of precision, especially if the numbers exceed a 32-bit signed integer, even if there were no decimal portion. There may be some things they can do to improve it, but they're sort of at the mercy of SpiderMonkey's code generator.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac