Hacker News new | ask | show | jobs
by hzoo 3099 days ago
> * From my measurements, TypeScript is quite a bit faster than Babel at compiling ES2017 to ES5. From a quick test, TypeScript took 35 seconds and Babel took 140 seconds when run on my codebase at work.

Hmm, I would of thought it would be the opposite but I guess it depends on the setup?

> * TypeScript is probably easier to set up and configure.

Yeah given it's more of a "language" TS can decide on those defaults although you can just make your own preset for your company/project as well. I think we can fix that too with a default/separate thing but not sure yet.

1 comments

I haven't looked too much into the TypeScript compiler implementation, but my theory is they've just had more bandwidth to do little optimizations or maybe got lucky on some design decisions rather than it being something fundamental. To be clear, this doesn't include any typechecking, so Babel and TypeScript are pretty much solving the same problem here.

I've actually been hacking on a faster alternative to babel/tsc for simple use cases: https://github.com/alangpierce/sucrase . It has a built-in benchmark (`yarn run benchmark`) with at least one example of where typescript is about 3x faster. So you could look at that config if you want one example to compare the two.