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

27
LINES

< > BotCompany Repo | #1010912 // printBenchResult

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2239L/14K).

1  
sS printBenchResult(long repetitions) {
2  
  ret printBenchResult(lastTiming(), repetitions);
3  
}
4  
5  
sS printBenchResult(long time, long repetitions) {
6  
  ret printBenchResult("", time, repetitions);
7  
}
8  
9  
sS printBenchResult(S msg, long repetitions) {
10  
  ret printBenchResult(msg, lastTiming(), repetitions);
11  
}
12  
13  
sS printBenchResult(long repetitions, S msg) {
14  
  ret printBenchResult(msg, repetitions);
15  
}
16  
17  
sS printBenchResult(S msg, long time, long repetitions) {
18  
  double secs = toSeconds(time)/repetitions;
19  
  S s = (empty(msg) ? "" : msg + ": ") + n2(repetitions, "step") + ". Each step took: ";
20  
  if (secs >= 1) ret print(s + formatDouble(secs, 3) + " s");
21  
  double ms = secs*1000;
22  
  if (ms >= 1) ret print(s + formatDouble(ms, 3) + " ms");
23  
  double us = ms*1000;
24  
  if (us >= 1) ret print(s + formatDouble(us, 3) + " µs");
25  
  double ns = us*1000;
26  
  ret print(s + formatDouble(ns, 3) + " ns");
27  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010912
Snippet name: printBenchResult
Eternal ID of this version: #1010912/10
Text MD5: 0a596c9102a6f8434ec6803694fcea55
Transpilation MD5: 4dd0a48e4e56a85e353249bd5e712e1e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-15 02:19:14
Source code size: 910 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 534
Version history: 9 change(s)
Referenced in: [show references]