This commit is contained in:
Brooke Vibber 2023-09-04 10:14:07 -07:00
parent 7dd97f6543
commit f7a6a4ab02

View file

@ -18,8 +18,9 @@ function doit() {
function make_randomized(x, y) { function make_randomized(x, y) {
let rando = (Math.random() * (2 ** 32 - 1)) | 0; let rando = (Math.random() * (2 ** 32 - 1)) | 0;
let buckets = 256; //let buckets = 256;
let r = 'random' + (rando % buckets); //random = rando % buckets;
let r = 'random' + rando;
let o = {[r]: r}; let o = {[r]: r};
if (Math.random() > 0.5) { if (Math.random() > 0.5) {
o.y = y; o.y = y;
@ -32,7 +33,8 @@ function doit() {
} }
const million = 1000 * 1000; const million = 1000 * 1000;
const n = 10 * million; const n = 1 * million;
const runs = 100 * n;
function bulk(filler) { function bulk(filler) {
let a = []; let a = [];
@ -64,8 +66,8 @@ function doit() {
console.log(`run ${i+1}`); console.log(`run ${i+1}`);
report(() => { report(() => {
let sumX = 0, sumY = 0; let sumX = 0, sumY = 0;
for (let i = 0; i < dataSet.length; i++) { for (let i = 0; i < runs; i++) {
let item = dataSet[i]; let item = dataSet[i % dataSet.length];
sumX += item.x; sumX += item.x;
sumY += item.y; sumY += item.y;
} }