-
Notifications
You must be signed in to change notification settings - Fork 179
Speed of Awesome-typescript-loader vs ts-loader #497
Comments
I have an uneducated guess, something to do with relying on Typescript's own module resolution logic. We've been using at-loader in a small project inside of a larger project, so there are nested node_modules folders. I was getting errors on modules I don't even use (not in my package.json, not imported in any code I'm using) because TS apparently goes searching for a whole crapload of type definitions for libraries that "might be somewhere in the folder tree, regardless of whether they're actually used or not." I found that there were 163K CreateFile calls looking for *.d.ts files (this api is also used to open files on Windows) when attempting to build my small project. Putting some typeRoots in the tsconfig.json helped some, but I've switched to ts-loader and it's running noticeably faster with forking in place. Again, just a wild guess :). |
@IAMtheIAM verified, My JIT/development Angular build went from 40 seconds down to 14 seconds. Once I figured out the right HappyPack configuration got it down to 12 seconds!
Thank you for the tip! |
Thank you for your feedback guys. I see that most of performance errors are coming from folks using I'm leaving this open for documentation reasons, but I doubt that I can do anything without a really deep investigation. |
With recent update to Angular 5 we had a huge performance issue on our CI: [at-loader] Using [email protected] temporary solution was to downgrade typescript. |
I believe that some critical performance problems were fixed in #517 (version 3.4.0-0), so please give it a try :-) |
@s-panferov works even faster than before |
for me awesome-typescript-loader (TS ^3) initial build(with WDS) 70-80s and incremental - 0.8(!)s. when ts-loader 30s (initial) and ~5s(incremental). i did a lot of research (hard-source-webpack-plugin, autoDll plugin, etc etc) and none of solutions have better incremental time(for dev its most needed then initial build time) |
Firstly, I think ATL Dev build: 0m38.939s |
@ozknemoy What is "WDS" in your comment? Webpack-...? |
@fatso83 webpack dev server |
After using awesome-typescript-loader for over a year, I decided to switch to
TS-loader
to test the speed difference. I'm glad I did. My angular 4 webpack-dev-server build went from 41 seconds down to 15 seconds, with absolutely no changes at all to config, only addingfork-ts-checker-webpack-plugin
, whichawesome-typescript-loader
does by default.Also, since TS-loader is compatible with
HappyPack
for parallel build processes, I got devserver build time down to 13 seconds. With webpackthread-loader
(instead of HappyPack) i got it down to 12 secondsMy AOT production build dropped from 122 seconds down to 93 seconds. With HappyPack/thread-loader, down to 79 seconds. Awesome!!
Awesome-typescript-loader, thanks for your hard work, the plugin works but ts-loader is much faster (for my specific setup) and that is important.
My question is, why is ts-loader so much faster than awesome-typescript-loader - or why perhaps might it be? 30 seconds saving is a lot of time.
In case anyone wants to see my new setup that is down to about 12 seconds, here it is
(this is for Angular 4+)
Basically you just pipe
ts-loader
tothread-loader
.As an EXTRA bonus, I just learned about hard-source-webpack-plugin. Using this plugin affects the above config like this, taking it from 14 seconds to:
Initial build: 22 seconds (twice as slow)
Rebuild: 6 seconds (double as fast)
What is does is write cache to disk, and makes it slower at first, but really fast on rebuild.
Here's how to enable that. I set it up to use a different cache for webpackDevServer, debug-production, and production build.
An alternative version of HardSourceWebpackPlugin is
cache-loader
. Its very similar, but a little faster on initial and a little slower on rebuild compared to HardSourceWebpackPluginInstead of being a plugin, its a loader, that goes as the very FIRST loader in the array, which means its the last loader executed by webpack. It is commented out in my example above for reference.
I hope this helps!
The text was updated successfully, but these errors were encountered: