Let's say that the custom_power
function took around 600
nanoseconds to execute. We can now compare with program 2.
Program 2:
Let’s now use the Python’s built-in pow
function to raise 3
to the power 4
and see how much time it ultimately takes.
xxxxxxxxxx
var start = new Date().getTime();
console.log(Math.pow(3, 4));
var end = new Date().getTime();
console.log(`Call to customPower took ${end - start} milliseconds`);
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment