michael@0: var nc = 30, maxCol = nc*3, cr,cg,cb; michael@0: michael@0: load(libdir + "util.js"); michael@0: michael@0: function allocateSomeStuff() { michael@0: return [{a: 1, b: 2}, {c: 3, d: 4}]; michael@0: } michael@0: michael@0: function computeSequentially() { michael@0: result = []; michael@0: for (var r = 0; r < ROWS; r++) { michael@0: for (var c = 0; c < COLS; c++) { michael@0: result.push(allocateSomeStuff()); michael@0: } michael@0: } michael@0: return result; michael@0: } michael@0: michael@0: function computeParallel() { michael@0: return new ParallelArray([ROWS, COLS], function(r, c) { michael@0: return allocateSomeStuff(); michael@0: }).flatten(); michael@0: } michael@0: michael@0: var ROWS = 1024; michael@0: var COLS = 1024; michael@0: var DEPTH = 2; michael@0: michael@0: benchmark("ALLOCATOR", 2, 6, michael@0: computeSequentially, computeParallel);