📜 ⬆️ ⬇️

Simple Javascript Benchmarker

How do you measure javascript code performance?
It happened to me like this:
  1. I create the index.html file;
  2. copying an HTML template from somewhere;
  3. I add a script tag in which the code under test will live;
  4. if you need to measure work with arrays, then you must create or take a ready-made random array generator.
The saddest thing is that the index.html file created earlier for testing is never at hand - the whole operation of preparing the test environment begins with the first item.
For me, this is the last day.

Simple JS Benchmarker is a simple tool for measuring the performance of javascript code.

How to work with him?
  1. If you need an array for the test, then we specify the data type and the number of elements.
  2. Set the number of iterations of the code under test.
  3. We copy HTML, for example, if you test work with DOM. You can also specify the option “on each iteration”, then the HTML will be updated with each iteration. All the markup "lives" on the right in the Context frame.
  4. Then paste the Javascript code you are testing. In fact, it will be the body of the function iteration , which has two document parameters (document object in Context) and array (generated array, or undefined). this inside the function will refer to the frame in Context.
At the output we get:For the future:Thank you for your attention, waiting for your feedback;)

')

Source: https://habr.com/ru/post/107291/


All Articles