Normal vs. Prototype

Benchmark created on


Setup

Number.prototype.limit = function (a, b) {
      return Math.max(a, Math.min(b, this));
    };

Test runner

Ready to run.

Testing in
TestOps/sec
Direct
var a = Math.max(250, Math.min(750, Date.now() % 1000))
ready
Prototype
var a = (Date.now() % 1000).limit(250, 750)
ready

Revisions

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