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

22
LINES

< > BotCompany Repo | #1005659 // Benchmark Quick Exceptions (QuickException/QuickThrowable) vs normal exceptions - 40 ns vs 4 µs (factor 100)

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

Libraryless. Click here for Pure Java version (881L/6K/22K).

1  
!752
2  
3  
sclass QuickThrowable extends Throwable {
4  
  public Throwable fillInStackTrace() { ret this; }
5  
}
6  
7  
static int n = 1000000;
8  
static O o;
9  
10  
// Difference might be even bigger than factor 100 with longer stack traces.
11  
12  
p {
13  
  twice {
14  
    time {
15  
      for i to n: o = new Throwable;
16  
    }
17  
    
18  
    time {
19  
      for i to n: o = new QuickThrowable;
20  
    }
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005659
Snippet name: Benchmark Quick Exceptions (QuickException/QuickThrowable) vs normal exceptions - 40 ns vs 4 µs (factor 100)
Eternal ID of this version: #1005659/4
Text MD5: fb04c20c0e3f215e6d5e7854915fb3d8
Transpilation MD5: a297c21a17d72f7e2026f3c7801efa96
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-07 14:41:27
Source code size: 376 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 536 / 548
Version history: 3 change(s)
Referenced in: [show references]