Questions tagged [v8]

V8 is Google's open source JavaScript engine.

About V8

V8 is Google's Javascript engine that is used in Google Chrome (). It is written in C++ (), and is open source, which can be checked out by following the instructions on the v8 wiki.

V8 can run standalone, or can be embedded into C++ applications.

Documentation on V8 can be found on its wiki pages.

There are a number of flags that can be passed to V8 to expose its internals. For instance, --trace-deopt gets V8 to log code deoptimizations, and --expose-gc allows scripts to manually invoke a garbage collection. The full list of flags can be found by reading the source.

Links:

Tag Usage

Use this tag to ask questions about:

  • Usage of the V8 API
  • Performance and profiling with V8
  • How V8 works
2955 questions
506
votes
10 answers

What is Node.js?

I don't fully get what Node.js is all about. Maybe it's because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The programming model is event driven, especially the way…
Jeff
  • 13,079
  • 23
  • 71
  • 102
283
votes
4 answers

How do I determine the correct "max-old-space-size" for Node.js?

I'm having some trouble to understand how Node.js acts based on the parameter max-old-space-size. In my case, for example, I'm running two t2.small AWS instances (2GB of RAM). Not sure why, but I did set max-old-space-size=4096 (4GB). What does node…
Borjante
  • 9,767
  • 6
  • 35
  • 61
187
votes
6 answers

When to use next() and return next() in Node.js

Scenario: Consider the following is the part of code from a node web app. app.get('/users/:id?', function(req, res, next){ var id = req.params.id; if (id) { // do something } else { next(); //or return next(); …
Amol M Kulkarni
  • 21,143
  • 34
  • 120
  • 164
173
votes
4 answers

Why is <= slower than < using this code snippet in V8?

I am reading the slides Breaking the Javascript Speed Limit with V8, and there is an example like the code below. I cannot figure out why <= is slower than < in this case, can anybody explain that? Any comments are…
Leonardo Physh
  • 1,443
  • 2
  • 9
  • 12
173
votes
5 answers

What do the return values of node.js process.memoryUsage() stand for?

From the official documentation (source): process.memoryUsage() Returns an object describing the memory usage of the Node process measured in bytes. var util = require('util'); console.log(util.inspect(process.memoryUsage())); This will…
Mahn
  • 16,261
  • 16
  • 62
  • 78
169
votes
4 answers

How does Bluebird's util.toFastProperties function make an object's properties "fast"?

In Bluebird's util.js file, it has the following function: function toFastProperties(obj) { /*jshint -W027*/ function f() {} f.prototype = obj; ASSERT("%HasFastProperties", true, obj); return f; eval(obj); } For some reason,…
Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
166
votes
2 answers

ECMAScript 6 features available in Node.js 0.12

A new stable release of Node.js (0.12) has landed recently with an upgraded Google's v8 JavaScript engine, v3.28.73. What ECMAScript 6 features are currently present in Node.js, without using the --harmony flag? I have checked several sites claiming…
Robert Rossmann
  • 11,931
  • 4
  • 42
  • 73
157
votes
13 answers

How to check which version of v8 is installed with my NodeJS?

How is V8 installed along with NodeJs? What version is my current V8 engine?
Lalith
  • 19,396
  • 17
  • 44
  • 54
140
votes
5 answers

Dumping whole array: console.log and console.dir output "... NUM more items]"

I am trying to log a long array so I can copy it quickly in my terminal. However, if I try and log the array it looks like: ['item', 'item', >>more items<<< ... 399 more items ] How can I log the entire array so I can copy it really quickly?
Anthony
  • 13,434
  • 14
  • 60
  • 80
139
votes
14 answers

Executing JavaScript without a browser?

I am looking into Javascript programming without a browser. I want to run scripts from the Linux or Mac OS X command line, much like we run any other scripting language (ruby, php, perl, python...) $ javascript my_javascript_code.js I looked into…
Daniel
  • 7,006
  • 7
  • 43
  • 49
132
votes
10 answers

Running V8 Javascript Engine Standalone

I want to run a Javascript console on top of V8. How do I do this?
Manuel
  • 6,461
  • 7
  • 40
  • 54
127
votes
6 answers

v8 JavaScript performance implications of const, let, and var?

Regardless of functional differences, does using the new keywords 'let' and 'const' have any generalized or specific impact on performance relative to 'var'? After running the program: function timeit(f, N, S) { var start, timeTaken; var…
sean2078
  • 5,131
  • 6
  • 32
  • 32
123
votes
15 answers

How to get a microtime in Node.js?

How can I get the most accurate time stamp in Node.js? ps My version of Node.js is 0.8.X and the node-microtime extension doesn't work for me (crash on install)
NiLL
  • 13,645
  • 14
  • 46
  • 59
122
votes
1 answer

Why is Math.pow() (sometimes) not equal to ** in JavaScript?

I've just discovered the ECMAScript 7 feature a**b as an alternative for Math.pow(a,b) (MDN Reference) and came across a discussion in that post, in which they apparently behave differently. I've tested it in Chrome 55 and can confirm that the…
Thomas Altmann
  • 1,744
  • 2
  • 11
  • 16
113
votes
4 answers

What is the performance of Objects/Arrays in JavaScript? (specifically for Google V8)

Performance associated with Arrays and Objects in JavaScript (especially Google V8) would be very interesting to document. I find no comprehensive article on this topic anywhere on the Internet. I understand that some Objects use classes as their…
BMiner
  • 16,669
  • 12
  • 53
  • 53
1
2 3
99 100