Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

store.has is a bottleneck #1788

Closed
mcollina opened this issue Dec 19, 2018 · 6 comments · Fixed by multiformats/js-cid#74
Closed

store.has is a bottleneck #1788

mcollina opened this issue Dec 19, 2018 · 6 comments · Fixed by multiformats/js-cid#74
Labels
exp/wizard Extensive knowledge (implications, ramifications) required P2 Medium: Good to have, but can wait until someone steps up

Comments

@mcollina
Copy link

  • Version: master
  • Platform: mac os X
  • Subsystem: blockstore

It seems that store.has (js-ipfs/node_modules/ipfs-repo/src/blockstore.js) is a bottleneck. This method in itself is ok, but the cids dependency allocates several unneeded buffers (https://github.com/multiformats/js-cid/blob/22504757cead5e3213d6fd4a385ab546885debe8/src/index.js#L129).

image

The above was generated with

STAGE=local REMOTE=true VERIFYOFF=true FILESET=One64MBFile WARMUP=Off clinic flame -- node multi-peer-transfer.js.

My recommendations are:

  1. cache all repeatable buffers so that they are not allocated multiple times
  2. develop and use the "simple buffer list utility" that we talked about several times.
@reconbot
Copy link

As an outsider do you have any references to the "simple buffer list utility" I can read? Is it something like BL but without being stream like?

@mcollina
Copy link
Author

Yes exactly. However we did some further analysis, and BL should be low-level enough even if it’s stream-like.

@reconbot
Copy link

I'm a fan of bl, added some features, but it's not too much to fork and drop the event emitter. I don't mind maintaining that if we could use it.

@mcollina
Copy link
Author

@reconbot we have validated that instantiating BL do not influence the performance of ipfs

@alanshaw alanshaw added exp/wizard Extensive knowledge (implications, ramifications) required status/ready Ready to be worked P2 Medium: Good to have, but can wait until someone steps up labels Jan 18, 2019
@reconbot
Copy link

reconbot commented Jan 18, 2019 via email

alanshaw pushed a commit to multiformats/js-cid that referenced this issue Feb 7, 2019
vmx pushed a commit to multiformats/js-cid that referenced this issue Mar 12, 2019
@ghost ghost removed the status/ready Ready to be worked label Mar 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/wizard Extensive knowledge (implications, ramifications) required P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants