From f7a6a4ab026032aca868a27fa5be6fd0199fb6e4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 4 Sep 2023 10:14:07 -0700 Subject: [PATCH] dataset --- speci.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/speci.js b/speci.js index 3b31dcf..e6e8f46 100644 --- a/speci.js +++ b/speci.js @@ -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; }