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 improvements #504

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adbutterfield
Copy link

@adbutterfield adbutterfield commented Jun 3, 2024

Hello! Wondering if you would be open to making some perf improvements that I identified?

Background:
I've been trying to improve performance on a test suite using Storybook test runner on a Github Actions based CI.

What I did:
I ran the test suite locally profiling with Clinic flame. react-docgen-typescript had some very hot blocks in the flame graph that I was able to cool down substantially by caching the results of some functions.

For reference, here's the initial run showing trimFileName.js as the hottest block in the entire profile. (Updated image, I put the wrong one at first...)
Screenshot 2024-06-03 at 11 42 10

Results:
My 33 test suites containing 63 tests in total dropped from ~26 seconds to ~14 seconds.

What I don't know:
If the cache keys I used are safe (could there be name collisions?). If you're interested in this kind of micro optimization for this repo.

type,
...propTags
};
if (parent?.fileName.includes('node_modules')) {
Copy link
Author

Choose a reason for hiding this comment

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

I put it like this at first, because I saw a ton of types coming from @types/react for all the native props. But I guess we could also cache user defined types in here as well.

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.

1 participant