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).

!7

svoid recurse(CancelPoint cp, int level) {
  if (level <= 1)
    cancelTo(cp);
  else
    recurse(cp, level-1);
}

cmodule BenchCancelPoints > DynSingleFunctionWithPrintLog {
  void doIt {
    int n = tenMillion();
    time repeat n {
      withCancelPoint(cp -> { cancelTo(cp); });
    }
    printBenchResult(n);
    
    int level = 5;
    time repeat n {
      withCancelPoint(cp -> { recurse(cp, level); });
    }
    printBenchResult(n, "level " + level);
  }
}

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: 308 / 2453
Version history: 6 change(s)
Referenced in: