I am trying to reconstruct the exact sequence of executed Javascript functions (call graph) from log data gathered using the Tracing Profiler, particularly from the category “v8.cpu_profiler”. Unfortunately, the number of nodes (function definitions) and edges (function calls) I obtain fluctuates across runs even if I interact with the test Web application in exactly the same way. Currently, I use
Tag: v8
What is the meaning of the prefix ‘Speculative’ and ‘Checked’ of Turbofan operators?
In the Turbofan IR, there are several operators whose name begins with ‘Speculative’ or ‘Checked’ (e.g. SpeculativeSafeIntegerAdd, CheckedInt32Add, CheckedFloat64ToInt32, …). What is the meaning of those prefix? Answer “SpeculativeSafeIntegerAdd” means “type feedback suggests that this + adds small integers, but that assumption must be guarded with a type check”. It’s an intermediate-level node that will be lowered further eventually. “CheckedInt32Add”
Would calling Performance API frequently be causing a performance issue?
I want to measure the memory usage of my web SPA using performance.memory, and the purpose is to detect if there is any problem i.e. memory leak during the webapp’s lifetime. For this reason I would need to call this API for specific time interval – it could be every 3 second, every 30 second, or every 1 minute, …
In V8, what is lazy deoptimization, and how does it happen?
According to V8 source code and turbofan materials, there is a type of deoptimization called lazy deoptimization which is described as follows(v8/src/common/globals.h): Lazy: the code has been marked as dependent on some assumption which is checked elsewhere and can trigger deoptimization the next time the code is executed. However, when observing the execution of ‘v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js’ with d8, I found that
Concurrency optimization job in V8
When concurrency optimization is triggered, a new optimization job will be dispatched to a child-thread to complete. How does Runtime know that the optimization job has been completed? I’ve found that in runtime function StackGuard, the optimized code will be set in JSFunction, but I don’t know how this function is triggered. Answer When an optimization job is complete, it
Three different `this` behaviours for three different JS engines
I was learning about the this keyword and how it means different things with regards to regular functions vs ES6 arrow functions and function expressions and I came across something odd when trying to run the following code in Chrome, Deno and Node. So I prepared following: Example: Deno output: Node output: Chrome output: According to my understanding of this,
Why does this dynamic programming optimization actually make code slower?
This is from Leetcode problem: Concatenated Words. Below is a working solution. I added what I thought to be an optimization (see code comment), but it actually slows down the code. If I remove the …
Is it more performant to mix types or to keep types?
I was wondering, with v8, when storing class attributes, is it more performant to use one variable with mixed types or one variable per type? Consider the following snippets (written in TypeScript for …
Create big json object js
I am using Nodejs to Create a JSON file from a really large JSON object (1GB). In order to avoid memory problems, I’m using createWriteStream : var writeStream = fs.createWriteStream(‘./output/outPut….
Object.entries() time complexity
Does anyone know the complexity of Object.entries() in Javascript? Based on this question I’d guess at maybe O(n) as well if it’s implemented by obtaining the keys and values as arrays then zipping …