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