Goksu Toprak
@gt
Looking for recommendations on improving the performance of importing wallets on React Native. Using Viem / Ox — Getting 1500ms from `mnemonicToAccount`: https://viem.sh/docs/accounts/local/mnemonicToAccount#mnemonictoaccount Getting 300ms from `privateKeyToAccount`: https://viem.sh/docs/accounts/local/privateKeyToAccount#privatekeytoaccount Looking for pointers to get either of these calls to at most 100ms. Understand that these are optimized in web / node / crypto context but not on React Native yet.
4 replies
4 recasts
31 reactions
Paul Miller
@paulm
1. That's pbkdf2. Overall pbkdf is supposed to be slow (100-300ms is norm), BUT mnemonicToAccount bip39 uses 2048 iterations. 2048 iters take 4ms on m4 mac, on older iphones maybe 15ms. Shit androids maybe 50ms. Definitely not noble issue. -- perhaps RN fucks up somewhere. I will take a look at optimizations. 2. privateKeyToAccount's first call calculates precomputes (20-30ms on mac). After that it's very fast. You can either reduce precompute window, or do precompute calc on the app start. cc @frederik @jxom
0 reply
0 recast
1 reaction