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

26
LINES

< > BotCompany Repo | #1011711 // Benchmark _SetField (28 ns)

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

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

!7

sclass MyClass implements _SetField {
  S a, b, c, d, e, f;
  
  public void _setField(S f, O x) {
    if (f.equals('a)) a = (S) x;
    else if (f.equals('b)) b = (S) x;
    else if (f.equals('c)) c = (S) x;
    else if (f.equals('d)) d = (S) x;
    else if (f.equals('e)) e = (S) x;
    else if (f.equals('f)) f = (S) x;
  }
}

static volatile new MyClass c;

p {
  int n = tenMillion();
  repeat 10 { time {
    repeat n {
      c._setField('e, "yo");
    }
  }}
  printBenchResult(n);
}

Author comment

Began life as a copy of #1011708

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011711
Snippet name: Benchmark _SetField (28 ns)
Eternal ID of this version: #1011711/7
Text MD5: 43f6e9a6c6b3325056929c62581f633d
Transpilation MD5: 0b0c56d47f622cb825e2f04649a5e4ae
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:08:41
Source code size: 518 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 847
Version history: 6 change(s)
Referenced in: [show references]