Ask HN: Why does Node.js start so slow?

  • What's your output for: `which node` and `node -v`

    On my M1 Pro:

        python3 -c 'print (123)'    0.02s user 0.01s system 86% cpu 0.036 total
        node -e 'console.log(123)'  0.04s user 0.01s system 88% cpu 0.053 total

  • I guess the reason is that the runtime of node is so much larger than that of Python and PHP. I think the Node runtime is already at > 50MB as a binary.

    I don't know how large Python and PHP runtimes are, but I know python is often stripped down to a few kilobytes for embedded systems.

    I guess if you preload the runtimes before executing these commands, the execution should be fairly similar for each one (near zero, more depending on I/O).