Libraryless. Click here for Pure Java version (9546L/53K).
sclass BenchWeightlessShuffledIteratorWithSeed { settable int seed = 0; // 0 will use the faster WeightlessShuffledIterator run { for (bool goodCase : falseTrue()) { for (int bits = 24; bits <= 28; bits++) { int n = (1 << bits)-(goodCase ? 1 : 0); printVars(+seed, +goodCase, n := n2(n)); var timed = returnTimed(-> { if (seed != 0) { var it = WeightlessShuffledIteratorWithSeed(n, seed); while (it.nextIndex() >= 0); } else { var it = WeightlessShuffledIterator(n); while (it.nextIndex() >= 0); } }); print("Nanoseconds per step: " + formatDouble(doubleRatio(timed.nanos(), n), 3)); } } } }
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035215 |
Snippet name: | BenchWeightlessShuffledIteratorWithSeed |
Eternal ID of this version: | #1035215/6 |
Text MD5: | 79ffe379d0f7c2e0517cab4773c50370 |
Transpilation MD5: | 140d0a700b82c0f3e34435cff7a03948 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-15 17:39:07 |
Source code size: | 776 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 176 / 247 |
Version history: | 5 change(s) |
Referenced in: | [show references] |