aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/harness
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/harness')
-rwxr-xr-xpackages/meshbay-hub/tests/harness/playlist_store_probe.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/meshbay-hub/tests/harness/playlist_store_probe.py b/packages/meshbay-hub/tests/harness/playlist_store_probe.py
index 83c00ad..6421426 100755
--- a/packages/meshbay-hub/tests/harness/playlist_store_probe.py
+++ b/packages/meshbay-hub/tests/harness/playlist_store_probe.py
@@ -395,7 +395,31 @@ function fakeNode() {
bodyKind('measure'), USER, key);
sizes[n] = sealed.length;
}
- steps.push({ step: 'what a playlist costs sealed', sizes });
+
+ // The same, with nothing to compress. Fourteen words of vocabulary is a
+ // library that repeats itself; a real one does not, and deflate's whole
+ // saving here comes from repetition. This is the pessimistic bound, and the
+ // number a reader is told has to sit under *it*, not under the friendly one
+ // — the two differ by enough to matter.
+ const noise = (n) => [...crypto.getRandomValues(new Uint8Array(n))]
+ .map((b) => 'abcdefghijklmnopqrstuvwxyz '[b % 27]).join('');
+ const diverseTrack = (i) => {
+ const artist = noise(18);
+ const album = noise(22);
+ const title = noise(26);
+ return { id: hex(16), g: 'g1', hv: 1, n: `${i % 20} - ${title}.flac`,
+ s: 30000000 + i, p: `${artist}/${album}`, t: title, a: artist,
+ b: album, d: 180 + (i % 300), tn: (i % 20) + 1 };
+ };
+ const diverse = {};
+ for (const n of [100, 500, 1000]) {
+ const tracks = [];
+ for (let i = 0; i < n; i++) tracks.push(diverseTrack(i));
+ const sealed = await seal({ v: 1, id: 'measure', rev: 1, device: 'aaa', tracks },
+ bodyKind('measure'), USER, key);
+ diverse[n] = sealed.length;
+ }
+ steps.push({ step: 'what a playlist costs sealed', sizes, diverse });
// ── a playlist too large for one frame is named, not swallowed ────────
//