Answer the question
In order to leave comments, you need to log in
How to measure script performance in CPU cycles?
I want to measure the performance of a certain piece of code. Now time measurements are used, using performance.now()
. But time is not the most accurate indicator due to a bunch of background processes and various factors. I heard that in v8 you can somehow measure the number of processor cycles before and after the execution of my code. But somehow I can't find how to do it.
Answer the question
In order to leave comments, you need to log in
It is not the number of cycles that matters, but the number of instructions that are executed in one cycle.
In fact, the number of cycles will give you little useful information. Profiling and benchmarks
will
be noticeably more useful
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question