Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A better comparison would be if the Crystal compiler was implemented in Ruby, how slow would it be?

Node is fast but there is an initial startup penalty, especially if the project has many files to load at runtime for interpretation. I bet it's spending a lot of time on require().



> A better comparison would be if the Crystal compiler was implemented in Ruby, how slow would it be?

Faster than tsc because Ruby doesn't need several seconds to start up and neither does node. Opal translates Ruby to JavaScript (and is implemented in Ruby) so we don't need to engage in unfounded speculation about non-existing implementations:

    % :>a.rb
    % time ./bin/opal --compile a.rb > a.js
    ./bin/opal --compile a.rb > a.js  0.54s user 0.12s system 90% cpu 0.735 total
It's not very fast, but still several times faster than TypeScript, and it includes a large runtime (the resulting file is 2M); disabling that speeds it up by ~150ms (most of that seems to be in the source map generation for the runtime, since --no-source-map with the runtime gives similar results). Opal is also a fairly small not-very-active project developed by a few people in their spare time, not a major language sponsored by a major company used throughout the world.

Coffeescript, which uses Node, also doesn't support from multi-second startup times:

    % :>a.coffee
    % coffee a.coffee
    % coffee a.coffee  0.10s user 0.03s system 101% cpu 0.125 total
> especially if the project has many files to load at runtime for interpretation. I bet it's spending a lot of time on require().

How often do I need to repeat it? It's a single empty file. Are people even reading what I'm saying or what because I've had to repeat this more than once now. It's a a file with zero bytes. No content in the file. No diskspace is used. The number of bits in the file is zero. A single empty file.


When I say this:

> especially if the project has many files to load at runtime for interpretation. I bet it's spending a lot of time on require().

I am talking about tsc itself. If there are hundreds/thousands of modules to load, node will spend time on that. coffeescript is a much smaller transpiler, with just a handful of source files.

EDIT - looks like tsc might get distributed as a single file, which helps here. However, it is a 7mb source file :)

https://raw.githubusercontent.com/microsoft/TypeScript/main/...

When I execute it locally, with no arguments, it finishes instantly as far as I can tell. So maybe tsc itself is indeed super slow for just an empty file.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: