-
Notifications
You must be signed in to change notification settings - Fork 44
[repo] Investigate why extended key path derivation is slow #778
Comments
What path does the extended key represent and what path is being derived? Node or browser? Sha2-512 is not very performant, but I’m planning on making v5 use the crypto version for node. How slow? |
A quick sample: |
Browser or node? |
node :) |
@IIIIllllIIIIllllIIIIllllIIIIllllIIIIll can you detail some ideas on improvements? |
What platform are you using? Running your exact code above I get it completing in 23ms (0.023s). What platform are you on? Is it a TravisCI instance, which is highly virtualized? What is the output of |
So apparently this only happens under jest. Really not sure where the bug lies. Minimum setup to reproduce: https://github.com/IIIIllllIIIIllllIIIIllllIIIIllllIIIIll/jest-ethers-bug |
Maybe related: jestjs/jest#5163 (comment) |
Fixed by #1187 @ricmoo : not sure if this is within the scope of ethers, but maybe there's a way of detecting if the key derivation function is run under a VM (https://nodejs.org/api/vm.html) and warning that it will be very slow? |
Definitely out of ethers scope. :p |
Naive profiling reveals that deriving paths from an extended key is slow and takes up a significant amount of time. We should investigate ways to improve this. cc @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll @ricmoo
The text was updated successfully, but these errors were encountered: