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

24
LINES

< > BotCompany Repo | #1025239 // Benchmark Cancel Points [OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (6052L/31K).

1  
!7
2  
3  
svoid recurse(CancelPoint cp, int level) {
4  
  if (level <= 1)
5  
    cancelTo(cp);
6  
  else
7  
    recurse(cp, level-1);
8  
}
9  
10  
cmodule BenchCancelPoints > DynSingleFunctionWithPrintLog {
11  
  void doIt {
12  
    int n = tenMillion();
13  
    time repeat n {
14  
      withCancelPoint(cp -> { cancelTo(cp); });
15  
    }
16  
    printBenchResult(n);
17  
    
18  
    int level = 5;
19  
    time repeat n {
20  
      withCancelPoint(cp -> { recurse(cp, level); });
21  
    }
22  
    printBenchResult(n, "level " + level);
23  
  }
24  
}

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: #1025239
Snippet name: Benchmark Cancel Points [OK]
Eternal ID of this version: #1025239/7
Text MD5: 1d0a2a02bae49e2fd2f45b04de9e1f3d
Transpilation MD5: 832d7867e89e2b90b6f972884670a2c4
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-15 02:18:31
Source code size: 493 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 2322
Version history: 6 change(s)
Referenced in: [show references]