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

improve import scanner perf #2900

Merged
merged 1 commit into from
Mar 19, 2021
Merged

improve import scanner perf #2900

merged 1 commit into from
Mar 19, 2021

Conversation

FredKSchott
Copy link
Owner

Changes

Two big changes here to help the perf issues reported here: #2896 (reply in thread)

  1. Fixed our shockingly slow import replacer. This dropped antd first load down from ~700ms to ~300ms
  2. Added memoization for our package import resolver. This dropped antd second load down from ~300ms to ~80ms.
  3. Bonus: Added @ant-design/icons-svg to the "never peer" list so that they get automatically bundled into any packages that request them. They're so small that this shouldn't seriously impact dev performance.

Testing

  • Covered by existing test suite.

Docs

  • N/A

@vercel
Copy link

vercel bot commented Mar 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/H1UaXRGzDTLcKjhHBU2ouUeDci3T
✅ Preview: https://snowpack-git-improve-import-scan-perf-pikapkg.vercel.app

@@ -239,6 +242,17 @@ export default {
depth = 0,
) {
config = config || _config;
// Imports in the same project should never change once resolved. Check the momized cache here to speed up faster repeat page loads.
Copy link

@fgblomqvist fgblomqvist Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because I can: "momized" -> "memoized" 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is it memized? Who knows 🤷‍♂️

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

words are hard :)

@fgblomqvist
Copy link

Are those stats the time per import?

@FredKSchott
Copy link
Owner Author

That's for just the antd import, although that's a pretty special edge case. The bottleneck was on the "per import within the package" processing time, and antd has something like 50 different import statements to other sub-packages within it. It's a big package...

@FredKSchott FredKSchott merged commit 35289b4 into main Mar 19, 2021
@FredKSchott FredKSchott deleted the improve-import-scan-perf branch March 19, 2021 16:16
@Manish3323
Copy link
Contributor

Manish3323 commented Mar 24, 2021

Hi @FredKSchott ,
just want to give a headsup.. it is still happening with our project for antd & ant-icons with the latest
version..snowpack keeps on building package & never stops...
here is the repo

I was being impatient here to try out new version.. pls ignore this comment it builds properly...
Cheers.. great work!!

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.

None yet

3 participants