fathyb / parcel-plugin-typescript

🚨 Enhanced TypeScript support for Parcel
MIT License
180 stars 18 forks source link

Much slower than vanilla Parcel #31

Open robcrocombe opened 6 years ago

robcrocombe commented 6 years ago

I'm testing this and Parcel on a large Angular 1.6 TypeScript project - bundled to about 8MB uncompressed, 4.4MB compressed.

I have found that the warm startup (with a .cache folder) is about the same speed, ~6 seconds. Cold startup (without .cache) is ~35 seconds with vanilla Parcel, but incredibly slow with the TS plugin, ~320 seconds - 5 minutes!

Watching files is also slower, about 1-5 seconds with the plugin depending on the amount changed. It's usually 0.3-1.5 seconds with vanilla Parcel.

Is there anything that can be done to improve performance? Thanks

fathyb commented 6 years ago

Thanks for the report. Is it still slow if you set transpileOnly to true? (see Configuration)

~Also does it only happens in build mode or in watch mode too?~ Nevermind I misread, it happens in both.

robcrocombe commented 6 years ago

With transpileOnly as true, its about the same as vanilla Parcel, only slightly slower when watching files it seems. But I also see no benefit to that mode?

mohsen1 commented 6 years ago

Maybe investigate spawning type checker into a separate thread to avoid holding critical path for type checking

fathyb commented 6 years ago

@mohsen1 this is already the case : https://github.com/fathyb/parcel-plugin-typescript/blob/develop/src/backend/worker/index.ts

I'm using the plugin on pretty big TypeScript projects at work (~400kLOC) and I get better performance than awesome-typescript-loader and ts-loader on CircleCI and our in-house Jenkins (never compared to vanilla Parcel given that type-checking is the slowest step on most ts projects).

This may be due to something else in your setup, if someone could provide a reproduction it would help me find out what's going on.

Keep in mind that TypeScript is almost (if not already) statically Turing-complete, if you use a lot of generics and infer it may slow down your build.