Download Jar. Libraryless. Click here for Pure Java version (951L/7K).
1 | !7 |
2 | |
3 | static int n = 1000000; |
4 | |
5 | p {
|
6 | TreeMap<S, Bool> map = litcimap(); |
7 | repeat n {
|
8 | map.put(randomID(), Bool.TRUE); |
9 | } |
10 | |
11 | repeat 5 {
|
12 | int i = 0; |
13 | time "Iterating" {
|
14 | for (S key : keys(map)) |
15 | ++i; |
16 | } |
17 | assertEquals(i, n); |
18 | |
19 | i = 1; |
20 | time "Iterating with higherEntry" {
|
21 | S s = map.firstKey(); |
22 | while ((s = map.higherKey(s)) != null) ++i; |
23 | } |
24 | assertEquals(i, n); |
25 | } |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1012166 |
| Snippet name: | Bench concurrency-safely iterating TreeMap [OK, 1 second vs 130 ms] |
| Eternal ID of this version: | #1012166/7 |
| Text MD5: | 086d854569eeca4260ae3a7e7d48973a |
| Transpilation MD5: | 6709c6790a03471edeabdc577690fcbd |
| Author: | stefan |
| Category: | javax / collections |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-11-23 10:49:02 |
| Source code size: | 446 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 798 / 1757 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |