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

30
LINES

< > BotCompany Repo | #1011712 // Benchmark setOpt with _SetField (26 ns)

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

Download Jar. Libraryless. Click here for Pure Java version (1028L/7K).

1  
!7
2  
3  
sclass MyClass implements _SetField {
4  
  S a, b, c, d, e, f;
5  
  
6  
  public void _setField(S f, O x) {
7  
    if (f.equals('a)) a = (S) x;
8  
    else if (f.equals('b)) b = (S) x;
9  
    else if (f.equals('c)) c = (S) x;
10  
    else if (f.equals('d)) d = (S) x;
11  
    else if (f.equals('e)) e = (S) x;
12  
    else if (f.equals('f)) f = (S) x;
13  
  }
14  
}
15  
16  
sclass MyOtherClass {}
17  
18  
static volatile new MyClass c;
19  
20  
p {
21  
  setOpt(new MyOtherClass, 'a, 0); // just to fill setOpt's cache
22  
  
23  
  int n = tenMillion();
24  
  repeat 10 { time {
25  
    repeat n {
26  
      setOpt(c, 'e, "hello");
27  
    }
28  
  }}
29  
  printBenchResult(n);
30  
}

Author comment

Began life as a copy of #1011708

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011712
Snippet name: Benchmark setOpt with _SetField (26 ns)
Eternal ID of this version: #1011712/3
Text MD5: 180b695aa0ce876ce65b8adb4a02e4fd
Transpilation MD5: 408366f4257819a5b9007fd8e7b82f36
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-02 19:05:43
Source code size: 616 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 1031
Version history: 2 change(s)
Referenced in: [show references]