Editing point array vs point object This edit will create a new revision. Your details (optional) Name Email (won’t be displayed; might be used for Gravatar) URL Test case details Title * Published (uncheck if you want to fiddle around before making the page public) Description (in case you feel further explanation is needed)(Markdown syntax is allowed) Are you a spammer? (just answer the question) Preparation code Preparation code HTML (this will be inserted in the <body> of a valid HTML5 document in standards mode) (useful when testing DOM operations or including libraries) <script> var point_o = function(x,y) { this.X=x; this.Y=y; } var point_a = function(x,y) { return [x,y]; } var point_o_arr = []; var point_a_arr = []; var x_arr = []; var y_arr = []; var x,y; var len=100; for(var i=0;i<len;i++) { x = Math.random()*10000; y = Math.random()*10000; point_o_arr.push(new point_o(x,y)); point_a_arr.push(point_a(x,y)); x_arr.push(x); y_arr.push(y); } //console.log(JSON.stringify(point_o_arr)); //console.log(JSON.stringify(point_a_arr)); </script> Include JavaScript libraries as follows: <script src="//cdn.ext/library.js"></script> Define setup for all tests (variables, functions, arrays or other objects that will be used in the tests) (runs before each clocked test loop, outside of the timed code region) (e.g. define local test variables, reset global variables, clear canvas, etc.) (see FAQ) Define teardown for all tests (runs after each clocked test loop, outside of the timed code region) (see FAQ) Code snippets to compare Test 1 Title Async (check if this is an asynchronous test) Code // R object for(var i=0;i<len;i++) { x = point_o_arr[i].X + 1; y = point_o_arr[i].Y + 1; } Test 2 Title Async (check if this is an asynchronous test) Code // R array for(var i=0;i<len;i++) { x = point_a_arr[i][0] + 1; y = point_a_arr[i][1] + 1; } Test 3 Title Async (check if this is an asynchronous test) Code // W object for(var i=0;i<len;i++) { point_o_arr[i].X = 1; point_o_arr[i].Y = 1; } Test 4 Title Async (check if this is an asynchronous test) Code // W array for(var i=0;i<len;i++) { point_a_arr[i][0] = 1; point_a_arr[i][1] = 1; } Test 5 Title Async (check if this is an asynchronous test) Code // RW object for(var i=0;i<len;i++) { point_o_arr[i].X = point_o_arr[i].Y + 1; point_o_arr[i].Y = point_o_arr[i].X + 1; } Test 6 Title Async (check if this is an asynchronous test) Code // RW array for(var i=0;i<len;i++) { point_a_arr[i][0] = point_a_arr[i][1] + 1; point_a_arr[i][1] = point_a_arr[i][0] + 1; } Test 7 Title Async (check if this is an asynchronous test) Code for(var i=0;i<len;i++) { x = x_arr[i] + 1; y = y_arr[i] + 1; } Test 8 Title Async (check if this is an asynchronous test) Code // W xy-array for(var i=0;i<len;i++) { x_arr[i] = 1; y_arr[i] = 1; } Test 9 Title Async (check if this is an asynchronous test) Code // RW xy-array for(var i=0;i<len;i++) { x_arr[i] = y_arr[i] + 1; y_arr[i] = x_arr[i] + 1 }