console.timeLog([label][,
...data])
For
a timer that was previously started by calling console.time(), it prints the
elapsed time and other data arguments to stdout.
/* Start the timer */ console.time('100000-elements'); for (let i = 0; i < 100000; i++) { } console.timeLog('100000-elements', "taken to iterate 100000 elements"); for (let i = 0; i < 100000; i++) { } console.timeLog('100000-elements', "taken to iterate 100000 elements"); /* End the timer */ console.timeEnd('100000-elements');
Output
100000-elements: 3.924ms taken to iterate 100000 elements 100000-elements: 11.753ms taken to iterate 100000 elements 100000-elements: 12.745ms
No comments:
Post a Comment