Download Jar. Libraryless. Click here for Pure Java version (7240L/51K).
!7 !include once #1024427 // LogNArray v4 p-exp { new LogNArray<Int> a; int n = 100000; int[] random = new int[n]; for i to n: random[i] = random(n); twice { time { a.clear(); for i to n: a.add(random[i]); }} printBenchResult("Adding", n); twice { time { for i to n: a.get(i); }} printBenchResult("Accessing in order", n); twice { time { for i to n: a.get(random[i]); }} printBenchResult("Accessing in random order", n); /*twice*/ { time { for i to n: { a.remove(mod(random[i], l(a))); } }} printBenchResult("Removing in random order (without warm-up)", n); }
Began life as a copy of #1024426
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024438 |
Snippet name: | Bench LogNArray (smaller array) |
Eternal ID of this version: | #1024438/1 |
Text MD5: | 0a38853026d3891aa95d0c1e5e90780e |
Transpilation MD5: | a158ecedad285b19d77f4233ce694543 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-12 17:27:01 |
Source code size: | 659 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 338 / 969 |
Referenced in: | -