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

14
LINES

< > BotCompany Repo | #1028032 // benchFor1Second

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

Libraryless. Click here for Pure Java version (2799L/17K).

1  
// returns minimal time needed
2  
static long benchFor1Second(S desc, Runnable r) {
3  
  ret benchForNSeconds(desc, r, 1);
4  
}
5  
6  
static long benchFor1Second(Runnable r) {
7  
  ret benchFor1Second(str(r), r);
8  
}
9  
10  
// returns result of function
11  
static <A> A benchFor1Second(S desc default str(f), IF0<A> f) {
12  
  benchFor1Second(r { f! });
13  
  ret f!;
14  
}

Author comment

Began life as a copy of #1018495

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028032
Snippet name: benchFor1Second
Eternal ID of this version: #1028032/3
Text MD5: 6d90f03a58c26cd6e3a85d86dd130b2c
Transpilation MD5: 3c19c2f4c1e80d5dde4e93df0ecd09c0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-13 15:48:55
Source code size: 346 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 210 / 319
Version history: 2 change(s)
Referenced in: [show references]