Well, nodejs uses V8 and it's installed
Edit: I'm trying to run the following benchmarks [1]:
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
Results: 99ms in my Chromium browser (v8 JIT enabled), it breaks in the WebVM (after typing `node` and enter) with `TODO: FAULT af5147bf / CODE da d9 83`Results (not using console time): 99ms in my Chromium browser (v8 JIT enabled), 680ms in WebVM (1050ms in the first run).
Conclusion: WebVM node is only 7 times slower than native v8 in my local machine (macOS M1 Max)
Try:
function mySlowFunction(baseNumber) {
const startTime = Date.now();
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.log(result, 'time:', Date.now() - startTime);
}
mySlowFunction(8);
I get ~100ms in Chromium and ~900ms in the WebVM (if I close the devtools)https://blog.stackblitz.com/posts/introducing-webcontainers/