Measure the speed of code execution

PHOTO EMBED

Mon Nov 04 2024 16:14:23 GMT+0000 (Coordinated Universal Time)

Saved by @maiden #html #json #javascript #css #jquery

var t0 = performance.now();
 
for (let i = 0; i < 10000; i++) {   
    // Do stuff here 
}  
 
// Do some other stuff here
 
var t1 = performance.now();
console.log("Call to doSomething took " + (t1 - t0) + " ms.")
content_copyCOPY

If you want to know how much time does it take to process parts of your code, put it in this snippet and find out.