MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.67k stars 4.78k forks source link

Faster cryptography #14577

Open hilvmason opened 2 years ago

adonesky1 commented 2 years ago

@Gudahtt could you remind us how you were thinking we might tackle this in the extension? cc @kumavis

Gudahtt commented 2 years ago

Some of the performance problems we saw in the past were caused by SES lockdown resulting in de-optimizations of certain operations. We have yet to explore workarounds for this. Some workarounds might be: performing the cryptographic operations using alternative methods that don't result in de-optimizations, or using WASM to perform the cryptographic operations.

The one example of this I can recall is the "export private key" functionality. We found it became extremely slow under SES lockdown in certain environments. I can't recall the details though, and can't seem to find the issue/PR.

The slowdown discovered recently with gridplus was another example of this. Maybe the lazy evaluation is enough of a fix for now, but we will still see the performance hit the first time that keyring is used.

adonesky1 commented 2 years ago

Initial goal: Identify where we can lazily load crypto packages.

Longer term: Look for new approach to cryptography

paulmillr commented 1 year ago

14928 could help here a lot, it's much faster for some operations that the current libs.