dromaeo-object-array-modern.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. startTest("dromaeo-object-array", 'bde4f5f4');
  2. let ret = [], tmp;
  3. const num = 500;
  4. const i = 1024;
  5. // TESTS: Array Building
  6. test("Array Construction, []", () => {
  7. for (let j = 0; j < i * 15; j++) {
  8. ret = [];
  9. ret.length = i;
  10. }
  11. });
  12. test("Array Construction, new Array()", () => {
  13. for (let j = 0; j < i * 10; j++)
  14. ret = new Array(i);
  15. });
  16. test("Array Construction, unshift", () => {
  17. ret = [];
  18. for (let j = 0; j < i; j++)
  19. ret.unshift(j);
  20. });
  21. test("Array Construction, splice", () => {
  22. ret = [];
  23. for (let j = 0; j < i; j++)
  24. ret.splice(0, 0, j);
  25. });
  26. test("Array Deconstruction, shift", () => {
  27. const a = ret.slice();
  28. for (let j = 0; j < i; j++)
  29. tmp = a.shift();
  30. });
  31. test("Array Deconstruction, splice", () => {
  32. const a = ret.slice();
  33. for (let j = 0; j < i; j++)
  34. tmp = a.splice(0, 1);
  35. });
  36. test("Array Construction, push", () => {
  37. ret = [];
  38. for (let j = 0; j < i * 25; j++)
  39. ret.push(j);
  40. });
  41. test("Array Deconstruction, pop", () => {
  42. const a = ret.slice();
  43. for (let j = 0; j < i * 25; j++)
  44. tmp = a.pop();
  45. });
  46. endTest();