-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
P2Medium: Good to have, but can wait until someone steps upMedium: Good to have, but can wait until someone steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredhelp wantedSeeking public contribution on this issueSeeking public contribution on this issuestatus/readyReady to be workedReady to be worked
Description
In IPFS repo.stat takes about 5s per call for me. I found that that the entire blockstore is read into memory every time this function is called to get the count and size:
Lines 301 to 317 in 3611043
| blocks: (cb) => this.blocks.query({}, (err, list) => { | |
| list = list || [] | |
| const count = new Big(list.length) | |
| let size = new Big(0) | |
| list.forEach(block => { | |
| size = size | |
| .plus(block.value.byteLength) | |
| .plus(block.key._buf.byteLength) | |
| }) | |
| cb(err, { | |
| count: count, | |
| size: size | |
| }) | |
| }), |
This needs to be streamed and/or calculated once, cached, and kept up to date.
Metadata
Metadata
Assignees
Labels
P2Medium: Good to have, but can wait until someone steps upMedium: Good to have, but can wait until someone steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredhelp wantedSeeking public contribution on this issueSeeking public contribution on this issuestatus/readyReady to be workedReady to be worked