Write performance issue & fix (rebuild_cfb) #12
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi there,
I discovered today some unusually slow operations when trying to create a rather large .msg file with roughly 63k data nodes. I tracked the slowness down to a nested loop in rebuild_cfb() that is ensuring that each stream node has a parent storage node.
I made some modifications to track the names in a in a JS object instead, and the
rebuild_cfb()
time dropped from about 1 minute to only 30 ms. I decided to use a plain object instead of aSet
just to maintain maximum compatibility with old browsers.Below are my changes with the added
fullPaths
object and the removed nested loop.Thanks for looking into this! Feel free to send a PR. One slight nit: we can't assume Object.create is available so maybe something like
Object.create ? Object.create(null) : {}
would play nice with IE8 and belowHmm good point. I was going to say that the <= IE8 version with the plain object then wouldn't work if the root folder happened to be named "__proto__" or "constructor", but I think the
dad
dirname will always end in a slash anyway (and probably start with "Root Entry/" for that matter).I'll work on a PR with your suggestion.