A
A
aPilot2016-02-27 18:04:12
JavaScript
aPilot, 2016-02-27 18:04:12

How to test script execution speed?

Maybe someone knows the most convenient way to test the speed of script execution.
Need to explore a couple of scripts without a website.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
RubaXa, 2016-02-27
@aPilot

- Раставить счетчики «руками» `new Date().getTime()`, `Date.now()` или `performance.now()`;
- console.time
- console.profile
- https://benchmarkjs.com/
- https://jsperf.com/ или https://jsbench.github.io/

M
Miku Hatsune, 2016-02-27
@Hatsune-Miku

It seems that developer tools in browsers have such a feature.

V
Vlad Tytcky, 2016-02-27
@vlad7576

The easiest way is to create a new date at the beginning of the script and then a new date at the end of the script. Subtract the first from the second and get the execution speed in milliseconds. https://yutex.ru/knowledgebase.html?article=85
Or you can use decorators for functions learn.javascript.ru/decorators

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question