Re:Computing file hashes with node.js
by SaltwaterC on Tuesday November 01, 2011 @09:50AM
(#3181976)
The comment about blocking the event loop is all about hogging the CPU with the hash computation, stuff that's not light. See the "node.js is cancer" article for more details. fs.readFile(), although non-blocking, is worse since it actually buffers the data. Some files may be larger than the system memory. Kinda impossible in this case to buffer all the bytes. Even without multiple calls to update(), node is still dog slow.
Re:Computing file hashes with node.js
by SaltwaterC on Tuesday November 01, 2011 @10:01AM
(#3182019)
PS: the number of update() calls isn't the issue. Increasing the ReadStream buffer from the default 40 KiB to 1 MiB makes it 0.2s slower although there are 25X less update() calls.
PS: timings of xxx-1.js and xxx-2.js are equivalent on several runs.