You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran the following code in the major browsers, node, and bun:
const{ Encrypter, Decrypter, generateIdentity, identityToRecipient }=awaitage();// Encrypt and decrypt a file with a new recipient / identity pair.conststart=performance.now();conste=newEncrypter();e.setPassphrase("burst-swarm-slender-curve-ability-various-crystal-moon-affair-three",);constciphertext=e.encrypt("Hello, age!");constd=newDecrypter();d.addPassphrase("burst-swarm-slender-curve-ability-various-crystal-moon-affair-three",);constout=d.decrypt(ciphertext,"text");console.log(out);console.log(performance.now()-start);
(This is just the passphrase example from the README with two lines added to measure duration.)
All on macOS 14.0 using M1 Max:
Chrome 119: ≈14000ms
Safari: ≈1000ms
Firefox: ≈1000ms
node: ≈1000ms
bun: ≈1000ms
This is "only" 4 orders of magnitude in terms of the work factor, but I'd love to figure out what's going on in Chrome.
The text was updated successfully, but these errors were encountered:
I just figured something out moments ago: the performance slowdown in Chrome happens only when I have DevTools open. When DevTools is closed, the results are nearly in line with other browsers.
lgarron
changed the title
Significantly slower in Chrome?
15× slowdown in Chrome when DevTools is open
Nov 3, 2023
15× is rather extreme, and the only reason I was able to find that bug is because of my experience looking up bugs as a Chrome developer. I understand that most devs would expect DevTools functionality over maximum performance, but this seems like it would still be a nasty surprise/source of confusion for anyone using the library without being aware of the caveat.
(SEE EDIT) In fact, this makes age.ts kind of unusable for my current library, because anyone developing with it in Chrome will be hit by extreme performance issues. Even by lowering the scrypt work factor to 2, it doesn't seem to get much better. 😬
(EDIT: looks like I was testing a bit wrong, a work factor of 12 turns out to be okay.)
I ran the following code in the major browsers,
node
, andbun
:(This is just the passphrase example from the README with two lines added to measure duration.)
All on macOS 14.0 using M1 Max:
node
: ≈1000msbun
: ≈1000msThis is "only" 4 orders of magnitude in terms of the work factor, but I'd love to figure out what's going on in Chrome.
The text was updated successfully, but these errors were encountered: