I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
Not really, is better to use a tool like benchmark.js and wrap your functions there, this way you avoid polluting your code and keep it away from the production bundles.
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
It depends on skills of developer, if he cannot write vanilla simple functions and doesn't know how to organize architecture and behavior of application, which produces polluting – then developer starts to use 3rd party libraries for trivial purposes.
If developer is skilled – it's enough to wrap using native functions, like console.time and console.timeEnd.
Please note, every time you re-run it will produce completely different results, so you can't event say how long it will take a particular function to run.
Unlike console.time(), benchmark allows you to run you suits lots of times, giving your more correct average results.
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
Of course, because processor allocates resources differently.
When we talk about measurement for unit tests or for performance function – time is the range of allowed min/max.
I agree, the dev must know what a framework does, but framework or vanilla, the LOC used to benchmark (like performance or console) would be better to be in separate .js files, which are not bundled into the product.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In case of unit tests measurement – current approach is perfect.
Not really, is better to use a tool like benchmark.js and wrap your functions there, this way you avoid polluting your code and keep it away from the production bundles.
It depends on skills of developer, if he cannot write vanilla simple functions and doesn't know how to organize architecture and behavior of application, which produces polluting – then developer starts to use 3rd party libraries for trivial purposes.
If developer is skilled – it's enough to wrap using native functions, like
console.time
andconsole.timeEnd
.For example:
Please note, every time you re-run it will produce completely different results, so you can't event say how long it will take a particular function to run.
Unlike console.time(), benchmark allows you to run you suits lots of times, giving your more correct average results.
Or you can test your units with jsperf.com/
Of course, because processor allocates resources differently.
When we talk about measurement for unit tests or for performance function – time is the range of allowed min/max.
I agree, the dev must know what a framework does, but framework or vanilla, the LOC used to benchmark (like performance or console) would be better to be in separate .js files, which are not bundled into the product.