Local Variables take 7x longer to access than global variables?
- by ItzWarty
I was trying to benchmark the gain/loss of "caching" math.floor, in hopes that I could make calls faster.
Here was the test:
<html>
<head>
<script>
window.onload = function()
{
var startTime = new Date().getTime();
var k = 0;
for(var i = 0; i < 1000000; i++) k += Math.floor(9.99);
var mathFloorTime = new…