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

!7

html {
  ret htitle("Web Worker-Less Calc Test")
    + hbody(
      p("Count numbers: " + hfulltag("output", "", id := "result"))
  + hjavascript([[
    var startTime, i = 0;
    
    function go() {
      if (!startTime) startTime = new Date();
      while (true) {
        i = i+1;
        if ((i % 1000000) == 0) {
          var ms = new Date()-startTime;
          var mips = (i/ms/1000).toFixed(2);
          document.getElementById("result").innerHTML = "Counted to: " + i + " in " + ms + " ms ("
            + mips + " million steps/s)";
          setTimeout(go, 0);
          break;
        }
      }
    }
  ]]).replace("$LINK", jsQuote(relativeRawBotLink(programID(), "worker.js"))), onLoad := "go()");
}

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: 391 / 751
Version history: 2 change(s)
Referenced in: [show references]