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

21
LINES

< > BotCompany Repo | #1005776 // Benchmark Making Screenshots (Full + Part)

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

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

1  
!752
2  
3  
p {
4  
  bench(r { shootScreen2(0, 0, 200, 100) }, 100);
5  
  bench(r { new BWImage(shootScreen2(0, 0, 200, 100)) }, 100);
6  
  //bench(r { shootScreen2() }, 1);
7  
  bench(r { new BWImage(shootScreen2()) }, 1);
8  
}
9  
10  
static int bench_seconds = 5;
11  
12  
svoid bench(Runnable runnable, int repetitions) {
13  
  long start = now();
14  
  while (now()-start < bench_seconds*1000) { // do it for at least x seconds
15  
    long time = now();
16  
    for i to repetitions:
17  
      runnable.run();
18  
    double duration = (now()-time)/(double) repetitions;
19  
    print(runnable + ": " + formatDouble(duration, 1) + " ms");
20  
  }
21  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005776
Snippet name: Benchmark Making Screenshots (Full + Part)
Eternal ID of this version: #1005776/1
Text MD5: 3f9b6e21736694552c433a6592d5130f
Transpilation MD5: b89922dee397758169cb701f61dcd07a
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-08 15:24:43
Source code size: 606 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 580 / 662
Referenced in: [show references]