3 ms·
Someone here commented that it takes 2.39s for tsc to check types for `console.log('Hello, world!')` [1] (esbuild does not check types). [1]: https://news.ycom
by tipiirai 3y ago
Someone here commented that it takes 2.39s for tsc to check types for `console.log('Hello, world!')` [1] (esbuild does not check types).
[1]: https://news.ycombinator.com/item?id=37765713 https://news.ycombinator.com/item?id=37765713
- richbell 3y agoThat seems like more of a tooling issue than a reflection of static vs dynamic typing.
- sensanaty 3y agoWhy do people keep using hello world as good examples of anything? I'm not a TS zealot at all, but my work project which is around 2000 TS/Vue files (some of them hundreds of lines long and even breaking into the thousands for a lot of them) manages to get checked in around 3 seconds if there's a cache, and no-cache runs take 10s or so (which also involves actually transpiling the files)
- tipiirai 3y agoThe parent was looking for evidence for why someone could write tests easier with dynamic languages. A long waiting time for type checking to finish came to my mind first. I think hello world is a valid example when talking about unit tests.
- the_af 3y agoI don't think Hello World is a good example for anything; all you can do with it is microbenchmark, which is not particularly interesting. There are also no meaningful unit tests to write with Hello World. With tiny examples, compile/tooling times tend to dominate. More interesting would be a larger, non-toy prototype, where the tests and prototyping effort are meaningful.
- the_af 3y agoThis is more of a reflection on tsc, but also, Hello World is not a good example because it's not a real world prototype. For conclusions about rapid prototyping you'd need to do this experiment: - Prototype something real, not a tiny toy example like "Hello, world". - Go end to end with your experiment, so instead of focusing on how long it takes to run the typechecker (which makes no sense, since dynamic languages don't have this step), measure how long it takes you to iterate your prototype from start to a finish (including everything: failed attempts, code does not do what you want, writing tests, troubleshooting stuff, and the final working demo). Again, I must ask: where is the evidence that dynamic languages are faster for prototyping? This paper by Paul Hudak, "An Experiment in Software Prototyping Productivity" [1] has multiple flaws you could argue, but what's amazing is that Haskell beat all other languages in the list (none under discussion here, sadly -- that's one of the flaws) for fast prototyping! -- [1] https://www.cs.yale.edu/publications/techreports/tr1049.pdf https://www.cs.yale.edu/publications/techreports/tr1049.pdf