160x slower than GNU which (~500ms vs. 3ms)
rlue opened this issue · comments
I had this installed on my system without even realizing it (it's hidden somewhere in the dependency tree for taskbook), and it was causing tremendous, very difficult-to-debug delays in a separate, totally unrelated, non-Node program (GNU pass).
time which
was reporting 500ms for this utility compared to 3ms for GNU which on a 4th-gen Core i5 Linux box. For some reason, it runs very fast on a comparably specced machine I own. Happy to help debug, if you tell me what you need.
Scratch that; on further inspection, it looks like node just takes that long to load. I inserted a console.log
debug statement at the top of the which
script, and it shows that 500ms+ pass before the first line of the script is evaluated:
#!/usr/bin/env node
console.log((new Date().getTime()) - Number(process.env.START))
var which = require("../")
...
$ START=$(($(date '+%s%N')/1000000)) which which
570
/usr/local/share/.config/yarn/global/node_modules/.bin/which
I don't suppose there's any chance you'd know offhand why node is so slow?
I'm not sure offhand, I mean, apart from "it does a bunch of stuff". I'd love to see node's startup time come down.