TIL Performance tests
POSTED ON:
TAGS: performance javascript optimization
While doing performance tests, I was curious how long a loop was running.
I used this trick to calculate the performance of a function.
const start = performance.now();
const end = performance.now();
const total = start - end;
console.log(`function took ${total} milliseconds to run`);
via 12 Important JavaScript Functions Every Web Developer Should Know
Related TILs
Tagged: performance