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

25
LINES

< > BotCompany Repo | #1013797 // Web Worker-Less Calc Test

JavaX module [tags: ai1-lol use-pretranspiled] - homepage

Download Jar. Libraryless. Click here for Pure Java version (1848L/12K/42K).

1  
!7
2  
3  
html {
4  
  ret htitle("Web Worker-Less Calc Test")
5  
    + hbody(
6  
      p("Count numbers: " + hfulltag("output", "", id := "result"))
7  
  + hjavascript([[
8  
    var startTime, i = 0;
9  
    
10  
    function go() {
11  
      if (!startTime) startTime = new Date();
12  
      while (true) {
13  
        i = i+1;
14  
        if ((i % 1000000) == 0) {
15  
          var ms = new Date()-startTime;
16  
          var mips = (i/ms/1000).toFixed(2);
17  
          document.getElementById("result").innerHTML = "Counted to: " + i + " in " + ms + " ms ("
18  
            + mips + " million steps/s)";
19  
          setTimeout(go, 0);
20  
          break;
21  
        }
22  
      }
23  
    }
24  
  ]]).replace("$LINK", jsQuote(relativeRawBotLink(programID(), "worker.js"))), onLoad := "go()");
25  
}

Author comment

Began life as a copy of #1013783

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1013797
Snippet name: Web Worker-Less Calc Test
Eternal ID of this version: #1013797/3
Text MD5: 0918522ae9b8c61d6916f7c1f7cc98a0
Transpilation MD5: 6d90dea20f2a8ae13b83eb52bda9e162
Author: stefan
Category: javax / web workers
Type: JavaX module
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-02-28 13:59:09
Source code size: 742 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 406 / 781
Version history: 2 change(s)
Referenced in: [show references]