Test case details

Preparation Code

<script> var UID = 0; </script>
// Need to generate core of the benchmark dynamically to ensure // that type feedback does not leak between individual sample runs. var code = " /* " + (UID++) + " */ " + " for (var i = 0; i < N; i++) {" + " var obj = arr[i];" + " result += obj.x + obj.y + i;" + "}" + "return result"; var f = new Function("N, arr, result", code); var K = 10; var objs = []; for (var i = 0; i < (K / 2); i++) { objs.push(new function () { this.x = 0; this.y = 0; } ()); } for (var i = 0; i < (K / 2); i++) { objs.push(new function () { this.y = 0; this.x = 0; } ()); } var mono = [], poly = [], poly2 = [], mega = []; var N = 20; for (var i = 0; i < N; i++) { mono.push(objs[0]) poly.push(objs[i % 3]) poly2.push(objs[(i % 3) || (K / 2)]) mega.push(objs[i % 6]) } var result = 0;
if (result < 0) throw "";

Test cases

Test #1

result = f(N, mono, result);

Test #2

// polymorphic but with matching property offsets result = f(N, poly, result);

Test #3

result = f(N, mega, result);

Test #4

// polymorphic but with different property offsets result = f(N, poly2, result);