-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ⚡ Double Digit Percentage Improvements. #169
Conversation
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
benchmarks/add-dir/src/helia.ts
Outdated
const rootCID = await unixFs.addDirectory({ path: parentDirectoryName }, unixFsAddOptions) | ||
|
||
for (const dirent of dirents) { | ||
await Promise.all(dirents.map(async dirent => { | ||
const path = nodePath.join(dir, dirent.name); | ||
|
||
if (dirent.isDirectory()) { | ||
const cid: CID = await addDir(path); | ||
rootCID = await unixFs.cp(cid, rootCID, dirent.name, { offline: true }) | ||
|
||
} else { | ||
const cid = await addFile(path); | ||
rootCID = await unixFs.cp(cid, rootCID, dirent.name, { offline: true }) | ||
} | ||
} | ||
const cid: CID = dirent.isDirectory() ? await addDir(path) : await addFile(path); | ||
await unixFs.cp(cid, rootCID, dirent.name, { offline: true }) | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whizzzkid since you're not changing the rootCID, the final returned rootCID is an empty directory with only a single block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed up some changes to this code. it does improve things, heres some output: testing /benchmarks/add-dir/node_modulesNew code
Old code
Resultshelia-fs -- ms/op decrease of 48.48% testing /node_modules/ipfs-coreNew Code
Old Code
Resultshelia-fs -- ms/op decrease of 17.49% |
* test: create add-dir benchmark * chore(bench/add-dir): remove unused taskResult prop * test(bench/add-dir): add kubo-direct test * docs(bench/add-dir): ipfs-core node_modules output * chore(bench/add-dir): kubo-direct doesnt pin files when adding * chore(bench/add-dir): split helia benchmark by blockstore type (fs/mem) * fix: ⚡ Double Digit Percentage Improvements. (#169) * fix: ⚡ 2x improvement Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> * fix: dag generation with parallelization at each level --------- Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> * test: use globSource in add-dir benchmark (#171) * fix: use glob source for importing directories - Use `globSource` from ipfs-utils for import - Make all impls return the same CID - Remove the dir size - if the CID is the same that's good enough * chore: fix linting * chore: remove benchmark from workspaces * test: align error and success output headers --------- Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> Co-authored-by: Alex Potsides <alex@achingbrain.net>
Improves: #167
Parallel Children at Each Level.