Skip to content

Instantly share code, notes, and snippets.

@bga
Created September 22, 2010 20:38
Show Gist options
  • Save bga/592519 to your computer and use it in GitHub Desktop.
Save bga/592519 to your computer and use it in GitHub Desktop.
"use strict";
(function()
{
var _warmUp = function()
{
var d = Date.now();
while(Date.now() - d < 4000)
{
var i = 1e6; while(i-- >= 0);
}
};
var _test = function(n, a)
{
var j = n; while(j-- >= 0)
{
var i = a.length; while(i-- >= 0)
a[i] = i;
}
};
_warmUp();
var d = Date.now();
_test(1000, new Array(1000));
trace('array', Date.now() - d);
var d = Date.now();
_test(1000, {length: 1000});
trace('object', Date.now() - d);
})();
// array 7100
// object 4887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment