Skip to content

Conversation

HamdaanAliQuatil
Copy link
Collaborator

Part of #198

EC key generation is faster and less likely to block the main thread because it uses scalar multiplication on elliptic curves, which is significantly less expensive than the prime generation and modular arithmetic involved in RSA. We're making a similar change here to ensure consistency across key generation paths and to ensure responsiveness.

@HamdaanAliQuatil HamdaanAliQuatil requested a review from jonasfj May 30, 2025 00:06
@jonasfj
Copy link
Member

jonasfj commented Jun 1, 2025

It's been ages since looked at EC stuff, but as I recall creating private key is dirt cheap, the most expensive part is deriving the public key... Thus, if the computational effort is not import public key, because you usually only store a compressed format... I don't recall the details.

Anyways, consistency shouldn't determine if offload to a background isolate or not. Computational cost should.

If isolate overhead exceeds the cost the offloading is pointless, sha256 is one such case. Copying the data is probably more expensive, than computing on main thread. Or at least close to the same cost.

Where RSA key generation is expensive, compared copying operations required to move off the main thread.

I don't know a good metric for whether something is worth moving is. But this probably what we should start by figuring out.

I propose we continue that discussion in
#198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants