3,075 questions
4
votes
1
answer
263
views
JavaScript and Chrome: Why does for...in run extremely fast the first time, but subsequent runs are slow?
I'm benchmarking (in Chrome) two ways of counting the number of properties in a JavaScript object.
I'm using Chrome Version 146.0.7680.31 (Official Build) beta (64-bit).
The first is by looping ...
Advice
2
votes
8
replies
202
views
Does V8 optimize curried functions like a typical functional programming language?
Functional programming languages like Haskell or OCaml go though some effort to make
curried functions have reasonable performance compared to uncurried functions. I am curious if V8 has any ...
1
vote
1
answer
131
views
Why does deleting a property from a JavaScript object significantly degrade performance compared to setting it to undefined? [closed]
I've been running some micro-benchmarks in Node.js v20.10 to understand how V8 handles object property removal. I noticed a massive performance discrepancy—a "performance cliff"—that seems ...
0
votes
1
answer
206
views
Why does heavy object cloning degrade JS performance even when using structuredClone compared to manual optimization? [closed]
In a high-performance Node.js service, I noticed that structuredClone() introduces unexpected latency spikes when cloning large nested objects (30–50 KB each). Even switching to manual cloning ...
1
vote
1
answer
94
views
How to call JS code from C++ thread in embedded Node.js/v8 environment
I have Node.js (v22 - I am bound to this version) embedded into my application and exposing a C++ object to its environment.
My JS environment setup (based on the docs) runs in a separate thread, like ...
2
votes
1
answer
122
views
How are eliminated values reconstructed during deoptimization in V8?
In Speculative Optimizations for WebAssembly using Deopts and Inlining the following statement is made:
The difference is in the code for the slow path. Without deopts, we don’t have the option of ...
0
votes
1
answer
145
views
How to retrieve triggers?
Google Sheets App Script v8: oauthScopes and ScriptApp.getProjectTriggers
Update:
See reproducible example.
App script trigger.gs contains a custom function that is called from the spreadsheet.
...
0
votes
1
answer
80
views
JS execution slower in built chromium binary compared to downloaded chromium binary
I am using puppeteer to run a bunch of JS to process HTML files in headless chromium. I noticed that when I use the Chromium binary downloaded from https://storage.googleapis.com/chromium-browser-...
2
votes
1
answer
121
views
How does the JavaScript engine handle object identity and prototype inheritance between ShadowRealms and the main execution context?
I’m experimenting with the ECMAScript proposal for ShadowRealm and ran into some deeply unintuitive behavior around object identity, function bindings, and prototype inheritance across realms.
...
7
votes
1
answer
229
views
Does JavaScript (V8) optimize concatenation of const strings like Java does?
I’m learning about string concatenation in JavaScript and how it compares to Java.
In Java, if you write:
final String LET = "a";
final String OOO = "aaaaa";
final String LET_OOO = ...
-1
votes
1
answer
254
views
js v8 function inlining
I'm intresed how and in what cases V8 perform inlining.
I know that V8 can inline functions to eliminate call cost, but i dont konw the rules for it to happen.
I got how it works in obvious cases, ...
2
votes
2
answers
263
views
Does V8 optimize inner functions based on closure values?
For example:
function makeFunc(a,b,c,d,e) {
return () => {
if (a) { /* do something expensive not referencing b,c,d,e */ }
if (b) { /* do something expensive not referencing a,c,...
1
vote
1
answer
135
views
js v8 computed property names and inline cache
as far as my understanding go, in v8 if property access occurs on object with persistent shape jit optimize it to prety much struct acces that is just offsetting a pointer but is the same rules ...
1
vote
1
answer
277
views
Updated to Rversion 4.5 - unable to install package `v8`
I have an unexpected issue installing v8 package in a new version of R 4.5under Ubuntu 22.04. This the output of running an install.packages() command in R:
I think I tried all possible options of ...
0
votes
1
answer
115
views
v8 Promise 'then' is called only if resolved in constructor
I have following problem with C++/v8 interoperability. When I resolve the promise outside the constructor, the then callback never gets called. Here is the javascript v8 code:
'use strict';
v8log (&...