DEV Community

Discussion on: How fast is your code?

Collapse
 
gmartigny profile image
Guillaume Martigny

Benchmarking is a skill on its own. Today's JS engine use a lot of shortcut and optimization, which impact performance tests.
It's also a balance between clear and maintainable code against fast and optimizable code. With modern computer power, I would largely prefer the first side.

Also, to measure time I would use developer.mozilla.org/docs/Web/API...

Collapse
 
ngduc profile image
Duc Ng

Right. console.time is useful for one time use.
If you want to capture measured data, store, analyze, visualize them, etc. then that's not enough.