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

sS printBenchResult(long repetitions) {
  ret printBenchResult(lastTiming(), repetitions);
}

sS printBenchResult(long time, long repetitions) {
  ret printBenchResult("", time, repetitions);
}

sS printBenchResult(S msg, long repetitions) {
  ret printBenchResult(msg, lastTiming(), repetitions);
}

sS printBenchResult(long repetitions, S msg) {
  ret printBenchResult(msg, repetitions);
}

sS printBenchResult(S msg, long time, long repetitions) {
  double secs = toSeconds(time)/repetitions;
  S s = (empty(msg) ? "" : msg + ": ") + n2(repetitions, "step") + ". Each step took: ";
  if (secs >= 1) ret print(s + formatDouble(secs, 3) + " s");
  double ms = secs*1000;
  if (ms >= 1) ret print(s + formatDouble(ms, 3) + " ms");
  double us = ms*1000;
  if (us >= 1) ret print(s + formatDouble(us, 3) + " µs");
  double ns = us*1000;
  ret print(s + formatDouble(ns, 3) + " ns");
}

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: 476 / 612
Version history: 9 change(s)
Referenced in: [show references]