gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Lazy require some expensive dependencies #459

Closed hansonw closed 6 years ago

hansonw commented 6 years ago

I've noticed that language-babel often contributes ~300ms to activation time. Looking at atom --profile-startup, we can see that this is actually due to three big and easily deferrable dependencies:

screen shot 2017-12-12 at 10 23 14 pm

It's extremely easy to get these out of the startup path by moving the require statements closer to their uses. The three major suspects in the screenshot are:

These are typically lower in practice due to Atom's v8 compile cache, but once these are lazily required language-babel consistently takes less than 100ms of activation time according to timecop.

gandm commented 6 years ago

@hansonw Thanks for the PR. Yes, lot of room for perf improvements!