v8

Why does node.js handle setTimeout(func, 1.0) incorrectly?

怎甘沉沦 提交于 2019-12-18 15:35:25
问题 While working on a timing sensitive project, I used the code below to test the granularity of timing events available, first on my desktop machine in Firefox, then as node.js code on my Linux server. The Firefox run produced predictable results, averaging 200 fps on a 1ms timeout and indicating I had timing events with 5ms granularity. Now I know that if I used a timeout value of 0, the Chrome V8 engine Node.js is built on would not actually delegate the timeout to an event but process it

Node.js with V8 suitable for limited memory device?

我的未来我决定 提交于 2019-12-18 11:46:00
问题 Would like to know is node.js with V8 engine suitable to be deployed on limited memory device (e.g. 256mb) and running in parallel with other process. I read that it will hook up the resource of the machine. Is there way to limit the memory and processing usage of V8 engine itself? 回答1: 256 MB is sufficient amount of RAM to run Node.js (e.g. on Linux VPS instance), assuming no other memory-hog software is run. Node has --max-stack-size argument for limiting the memory usage. Node's single

nodejs out of memory

。_饼干妹妹 提交于 2019-12-18 10:22:45
问题 I came across a curious issue today. This may be an easy answer for others, but it has me stumped. Why does the code below cause a memory error? var cur = 167772160; var bcast = 184549375; var addresses = []; while (cur <= bcast){ cur += 1; addresses.push(cur); } addresses.length addresses // memory goes from a few megs to over a gig in seconds when trying to print this I get one of these two errors...the first when i run this code in node's interpreter and the latter when i run it through

What version of Javascript is supported in node.js

守給你的承諾、 提交于 2019-12-18 10:08:54
问题 I'm getting started with Node.js and I'm having a hard time figuring out what version of JavaScript is supported by node which makes it difficult figuring out what features I can use. Here's what I know. Node uses V8 V8 implements ECMAScript as specified in ECMA-262, 3rd edition ECMA-262, 3rd edition is JavaScript 1.5 Given this, I would assume I can use JavaScript 1.5 compatible code in node. However, it turns out I can use the Array.forEach, among other constructs, even though according to

Profiling JavaScript Code on nodejs - Possible Approaches

丶灬走出姿态 提交于 2019-12-18 09:43:08
问题 My aim is to develop a java script profiler for nodejs . The requirements are as under : Should be able to fetch call stack . Get Time stamp information. Get number of iterations. My chief concern is that i should not modify the source file ( .js file ) . I have seen all the available profiling options for JavaScript code on node js . The problem i face is that most of them require manual injection of the profiling specific code into my source code. Here is an example var profiler = new

Javascript engine with good interoperability with JVM and CLR

a 夏天 提交于 2019-12-18 06:48:30
问题 Due to the huge resources behind it, Javascript seems to rapidly becoming the scripting language of choice for applications, particularly those with a web front end. I have an application that requires extensibility both on the front and backend. Javascript, or a thin wrapper like CoffeeScript, seems like an excellent, future-oriented, choice. The problem I'm having with using Javascript as the target is interoperability with existing server side libraries. V8 requires custom C++ code. I'd

Node.js source code build giving segmentation fault on ARM

天涯浪子 提交于 2019-12-18 04:05:34
问题 tl;dr: I tried to install node.js on my ARMv7-based Cubox running Ubuntu 12.10 (quantal). When compiling node.js from source (see "Second attempt" below), node produces a segmentation fault. What can I do here? First attempt First of all, I tried to install node.js via the package manager, following the instructions for Ubuntu that are given here: Installing Node.js via package manager: Ubuntu, Mint Adding the repository mentioned there using sudo add-apt-repository ppa:chris-lea/node.js

Javascript var vs let (de)optimization/slowdown issue in v8 and SpiderMonkey

早过忘川 提交于 2019-12-18 03:47:33
问题 During JavaScript code refactoring in my project I've found that some of my loops slowed down drastically. Searching for root cause I've found this SO question stating slowdown is caused by let statement inside for loop and closure creation. To my surprise moving let and closure out of the for loop didn't help, and even using var instead of let for loop variable also does not help because slowdown is caused by let placed after the for loop. By removing extra details I've obtained this code

Why V8 in Node.JS is faster than in my native C++ addon?

孤街醉人 提交于 2019-12-17 21:53:47
问题 Why Google's V8 JavaScript engine in my C++ addon works significantly slower than in Node.JS? I've tried to write some stupidly simple code for generating prime numbers in the JavaScript and ran it in V8 via my C++ addon and directly in Node.JS. I was quite shocked, because both should be using the same JavaScript engine and both have executed the same code (time in milliseconds, less is better): V8 in Node.JS: 495517 V8 in Node.JS C++ Addon: 623598 Here is the source of JavaScript module and

why does attempting to write a large file cause js heap to run out of memory

风流意气都作罢 提交于 2019-12-17 19:36:28
问题 this code const file = require("fs").createWriteStream("./test.dat"); for(var i = 0; i < 1e7; i++){ file.write("a"); } gives this error message after running for about 30 seconds <--- Last few GCs ---> [47234:0x103001400] 27539 ms: Mark-sweep 1406.1 (1458.4) -> 1406.1 (1458.4) MB, 2641.4 / 0.0 ms allocation failure GC in old space requested [47234:0x103001400] 29526 ms: Mark-sweep 1406.1 (1458.4) -> 1406.1 (1438.9) MB, 1986.8 / 0.0 ms last resort GC in old spacerequested [47234:0x103001400]