Limit max/min tests

JavaScript performance comparison

Test case created by hnldesign

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
minified maciej
function maxmin_minified(val, min, max) {

  'use strict';
  return (val > min) ? ((val < max) ? val : max) : min;
}
maxmin_minified(901348, 0, 1000);
pending…
hnldesign
function valBetween(v, min, max) {

  'use strict';
  return (Math.min(max, Math.max(min, v)));
}
valBetween(901348, 0, 1000);
pending…
maciej
function maxmin(val, min, max) {

  'use strict';
  if (val > min) {
    if (val < max) {
      return val;
    } else return max;
  } else return min;
}
maxmin(901348, 0, 1000);
pending…

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

Compare results of other browsers

0 Comments