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
1
vote
2 answers

Rewriting PHP/Smarty site to Node.js

I decided to play a bit with Node.js because I like Javascript a lot as a language and because V8 is so fast. I work with mobile sites a so if I manage to reduce the page response time it will be very good. I have a relatively simple site built…
Daniel Iankov
  • 306
  • 3
  • 7
1
vote
1 answer

Why would a function called from another not show in the profile output of a node app?

I have a NodeJS program. This is a trimmed down version of a much larger program with a lot of complexity that's irrelevant to this question removed. It goes through lists looking for matching objects: /** * Checks that the given attributes are…
Richard Wheeldon
  • 973
  • 10
  • 25
1
vote
2 answers

V8 version in node and ChromeDevTools?

My main questions are: What version of V8 am I running from node 0.4.10? How can I tell if this version is compatible with ChromeDevTools 0.2.2 in Eclipse? Background: I've almost got Eclipse working for debugging node.js remotely. In fact it…
mjhm
  • 16,497
  • 10
  • 44
  • 55
1
vote
1 answer

Why V8 (a javascript module) deserializes two 2 different hex strings but brings 2 identical objects?

I've trying to figure out why this happens. const v8 = require('v8') let stringa =…
1
vote
1 answer

Setting --max-old-space-size but Node still exceeds the limit without causing any errors

I set a max size to 512mb but it doesn't seem to cause any error and it exceeds the limit and goes up 1.3GB. I understand that node will try to GC when it approaches the limit and error out when it exceeds the set limit. I'm running tests and I want…
John Yepthomi
  • 472
  • 6
  • 13
1
vote
0 answers

Memory leak in event handler for a file read stream when processing lines with an object lookup

I want to read a large file (~250M lines) in nodejs and perform some simple processing on each line. Since the file is so large, I want to read it one line at time. The processing steps on each line are as follows: Split the line by tabs (it's a…
James
  • 1,100
  • 1
  • 13
  • 29
1
vote
1 answer

How is object lookup implemented by Map.get(obj) in the javascript v8 engine?

I'm curious about the internals of v8 and how Map is implemented under the hood. Contrasting Maps, javascript objects cannot have objects as keys. As far as I understand it Maps implement lookup in the classic hash map fashion. Some hashing function…
david_adler
  • 9,690
  • 6
  • 57
  • 97
1
vote
1 answer

Will memory usage change between `await Promise.all` and `X = await Promise.all`?

For example, if each of the promises resolved with a value that has 1 byte, and the number of promises is 100,000 await Promise.all(promises) // not capture the return value X = await Promise.all(promises) // capture the return value Obviously,…
yaquawa
  • 6,690
  • 8
  • 35
  • 48
1
vote
0 answers

Storing shuffled arrays in a parrent array

Problem : Main array have identical arrays instead of shuffle arrays after shuffling // Initiating an empty array const mainArr = [] // Random array with any values const arr = [1, 2, 3, 4, 5] // Function to shuffle array let shuffleArray =…
1
vote
1 answer

A better way to implement in-memory-cache in javascript / nodejs

I had a question. The following code has a memory leak: let inMemoryCache = {}; app.get("/hello",(req, resp) => { inMemoryCache[unixTimeStamp] = {"foo":"bar"} resp.json({}); }); Isn't it? The size of the object inMemoryCache will keep on…
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
1
vote
0 answers

Google.script.run functions failing in firefox, safari

I am implementing a HTML sidebar and Modal dialogue in an Appscript Project bound to a Google Sheet. The HTML pages call scripts from my scripts.gs file in two different ways - onload and onclick. Both of these work fine in Chrome 89.0.4389.90…
1
vote
1 answer

Errors when compiling v8 on Windows

I'm following https://v8.dev/docs/embed to compile the sample program for embedding v8. I was able to complete it in Debian with no issues. I'm encountering compilation errors when building v8 on Windows. I got the v8 source, and I tried compiling…
MakotoE
  • 1,814
  • 1
  • 20
  • 39
1
vote
1 answer

see execution time of javascript code next to each call

Is it possible to see execution time like the image bellow, but in Node without the gibberish in vscode javascript debugger or without using the console.time('debug') and console.timeEnd('debug') functions ? Edit 1 : Something like this is…
1
vote
1 answer

How does Chrome JS console do pre-evaluation?

Chrome JS Console only pre-evaluates (displays a gray result before you hit enter on a line of JavaScript code) expressions that don't have side effects. How does Chrome tell? Side effects tested: changing closured(non-local) variables, altering…
1
vote
1 answer

How to return cv::Mat in nodejs addon

I've written nodejs addon using V8. I'm stuck at a point where I'm trying to return Mat but all I'm getting is corrupted image with size of 2mb (for particular image). Am I doing something wrong? How can I do this using V8? CPP code snippet cv::Mat…
Atul Singh
  • 175
  • 1
  • 14