ipfs-inactive / js-ipfs-unixfs-exporter

[ARCHIVED] JavaScript implementation of the UnixFs exporter used by IPFS
MIT License
2 stars 3 forks source link

perf: only descend into hamt subshard that has the target entry #10

Closed achingbrain closed 5 years ago

achingbrain commented 5 years ago

Since bucket indexes are stable based on the file input and current tree state, we can predict which subshard will contain a given file based on how deep we are in the hamt, so there's no need to traverse the entire shard to find one file.

Fixes #9

achingbrain commented 5 years ago

This PR decreases the time it takes to read a file from the HAMT shard that backs our npm-on-ipfs registry from about three minutes (😱) down to about a second, so I'm going to merge this and address the outstanding issues in further PRs.