By ways4.eu
on Sat Apr 25 2020
I have recently become interested in the web performance side of web development. Iβm wondering if the way Iβm calculating the amount of time it takes a block of code to run correct and trustworthy?
Essentially what I do is wrap a console.time(), and a console.timeEnd around a block of code like so.
function copyToClipboard1(e) { console.time('Exec #1'); const clipboard = emailInput; clipboard.value = this.value; clipboard.select(); document.execCommand("copy"); console.timeEnd('Exec #1'); } This then returns something like this Navigator #1:0.0869140625ms. Is this an efficient way of calculating the speed of a code block. The result each time are usually similar enough?
submitted by /u/Deviso
[link][comments]
from ππππππππππ https://ift.tt/2S6lddz