Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

32
LINES

< > BotCompany Repo | #1024426 // Bench LogNArray

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (14832L/102K).

!7

!include once #1024427 // LogNArray v4

p-exp {
  new LogNArray<Int> a;
  int n = 5000000;
  
  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);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024426
Snippet name: Bench LogNArray
Eternal ID of this version: #1024426/13
Text MD5: 44d08196453f8c432b345575a5a4c1ef
Transpilation MD5: 3a8cf8cb9388502b9ff222df90713983
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 14:37:38
Source code size: 660 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 328 / 973
Version history: 12 change(s)
Referenced in: [show references]