function vs. Math.min vs. if condition (v13)

Revision 13 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
ternary operator
var a = Math.random();
var b = Math.random();
var min = (a < b) ? a : b;
ready
Math.min
var a = Math.random();
var b = Math.random();
var min = Math.min(a, b);
ready
if condition
var a = Math.random();
var b = Math.random();
if (a < b) var min = a;
else var min = b;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.