Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Slowness #37

Closed
zoltanbedi opened this issue Feb 19, 2019 · 7 comments
Closed

Slowness #37

zoltanbedi opened this issue Feb 19, 2019 · 7 comments

Comments

@zoltanbedi
Copy link

Hey guys,

I was wondering if using this loader is really that slow or I'm doing something wrong.
So creating the docs for ~57 components takes about ~1.5 minutes. Without docgen it builds around ~10 seconds.
Is there a way to only create these docs for storybook-static and not for start-storybook?

@davidlacasse
Copy link

Same issue here, we roughly have around 80 components and it take ~5 minutes to start. Unfortunately we haven't found any solution yet.

@zoltanbedi
Copy link
Author

I've spent the other night trying to solve this.
So I found out the slowness is related to styleguidist/react-docgen-typescript#112

I have noticed that the parser creates a new Typescript program (ts.createProgram) a new Parser, which take about 400ms and 150ms each. This of course gets ran once for every component.

Also there was a possible fix for that where you can pass a typescript program as a parameter but I couldn't make it work with the loader. So I've written a webpack plugin that will do the doc generation at the end of the build. It worked. Now it builds in ~17 seconds.

It is not the cleanest code but it works well. You can take a look at it and add it to your project as well.
see my pr with the plugin

@zoltanbedi
Copy link
Author

I'm going to close this issue because my problem is solved. 😃

@strothj strothj reopened this Feb 20, 2019
@strothj
Copy link
Owner

strothj commented Feb 20, 2019

Cool, thanks. I'm going to leave this open so I remember to look this over.

@pedronauck
Copy link

Wow, such a huge slowness reducement creating a custom program @B3zo0 👏

@denieler
Copy link
Contributor

I think we can close this issue, right @strothj ?

@strothj
Copy link
Owner

strothj commented Apr 12, 2019

Awesome work @B3zo0 and @denieler . Closing this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants