@snigo got there first, but was going to say, this isn’t going to tell you anything, you need to run it hundreds/thousands of times to get any reasonable comparison. And in this case it’s almost completely pointless, because it’s so simple: just write
function sub(a, b) {
return a - b;
}
If you want a subtract function. That is extremely readable and extremely fast. Any optimisation is faintly ridiculous here, particularly given it’s entirely based on how a particular JS engine is implemented.
Optimising your code in the way you’re trying to do is [imo] a fools errand – JS is a very high level language with multiple implementations, and trying to second guess the specific compiler/interpreter being used is not a great idea, particularly if you’re only starting to learn programming.