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

14
LINES

< > BotCompany Repo | #1018495 // benchFor5Seconds

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

Transpiled version (2775L) is out of date.

// returns minimal time needed (nanos)
static long benchFor5Seconds(S desc, Runnable r) {
  ret benchForNSeconds(desc, r, 5);
}

static long benchFor5Seconds(Runnable r) {
  ret benchFor5Seconds(str(r), r);
}

// returns result of function
static <A> A benchFor5Seconds(S desc default str(f), IF0<A> f) {
  benchFor5Seconds(desc, r { f! });
  ret f!;
}

Author comment

Began life as a copy of #1006403

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018495
Snippet name: benchFor5Seconds
Eternal ID of this version: #1018495/8
Text MD5: 7e73d5cbbae03e01957214c14af9759c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-28 22:34:01
Source code size: 365 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 494 / 703
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1028032 - benchFor1Second
#1029085 - dm_benchAndProfileFor5Seconds
#1034259 - benchFor10