Cached Math vs Global

Benchmark created on


Preparation HTML

<script>
  var cachedMath = function() {
      var m = Math;
      return m.pow(2, 8) + m.sqrt(16) + m.PI;
      };
  
  var globalMath = function() {
      var m = Math;
      return Math.pow(2, 8) + Math.sqrt(16) + Math.PI
      };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Cached Math
var n = cachedMath();
ready
Global Math
var n = globalMath();
ready

Revisions

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