We know that Chrome and node.js runs on the same V8 javascript engine. My understanding:
So, was comparing simple speed test for node.js's V8 javascript
With Chrome's V8
Why is node.js so slower than Chrome?
Btw, here is the code:
function speedTest(){
console.time("loop");
for (var i = 0; i < 1000000; i += 1){
// Do nothing
}
console.timeEnd("loop");
}
TL;DR In absolute terms, it's not.
First, those numbers are not 'different enough' to represent a real performance difference. Yes, in this trial they may differ by 25%, but in the context of concern , it's not significant.
Second, V8 is not doing the UI work in Chrome: compositing, rendering and painting are done on processes and threads which are dedicated to that purpose :
Third, node is faster than the browser on my tests, which at 0.5 to 1 ms is also meaningless. More importantly, it negates the premise of the question.
Beware that;
the console.log timers and in generals timers in javascript are not quite precise
there are more features on the node V8, like the fs
I don't think that the UI has something to do with the V8
I can't answer the question; however, the other answers don't shed much light on the matter. See http://www.jsbenchmarks.com/?anywhichway/lookup/master/benchmark.js/ for an example of how NodeJS and browsers differ dramatically. Note, although the browser result son this site are from multiple visitors and the Node results are from a single server, tests in an isolated environment show the same thing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.