Libraryless. Click here for Pure Java version (9546L/53K).
1 | sclass BenchWeightlessShuffledIteratorWithSeed { |
2 | settable int seed = 0; // 0 will use the faster WeightlessShuffledIterator |
3 | |
4 | run { |
5 | for (bool goodCase : falseTrue()) { |
6 | for (int bits = 24; bits <= 28; bits++) { |
7 | int n = (1 << bits)-(goodCase ? 1 : 0); |
8 | printVars(+seed, +goodCase, n := n2(n)); |
9 | |
10 | var timed = returnTimed(-> { |
11 | if (seed != 0) { |
12 | var it = WeightlessShuffledIteratorWithSeed(n, seed); |
13 | while (it.nextIndex() >= 0); |
14 | } else { |
15 | var it = WeightlessShuffledIterator(n); |
16 | while (it.nextIndex() >= 0); |
17 | } |
18 | }); |
19 | |
20 | print("Nanoseconds per step: " + formatDouble(doubleRatio(timed.nanos(), n), 3)); |
21 | } |
22 | } |
23 | } |
24 | } |
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: | 178 / 251 |
Version history: | 5 change(s) |
Referenced in: | [show references] |