Skip to content
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

perf(ZipOpenFS): replace FILE_PARTS_REGEX with indexOf implementation #2796

Merged
merged 3 commits into from
Apr 27, 2021

Conversation

paul-soporan
Copy link
Member

What's the problem this PR addresses?

findZip inside ZipOpenFS isn't as fast as it can be because we use a regexp to extract the archive part from paths.

How did you fix it?

By using an indexOf-based implementation that is 3.7x faster.

Profiled on the Storybook repo (lockfile only install):

  • Before: 337.0 ms (spent executing the regexp)
  • After: 89.2 ms (spent inside getArchivePart)

I haven't tested how much it improves PnP runtime's perf, but it would be interesting to see. 🤔

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit 30e1d3c into master Apr 27, 2021
@arcanis arcanis deleted the paul/perf/zipopenfs-indexof branch April 27, 2021 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants