Live data from Hacker News

Checkbox Olympics

checkboxolympics.com

31–40 of 51 posts

Re: Checkbox Olympics

#31
post #25

$('.readyButton').click(); setTimeout(()=> [...document.querySelectorAll('input[type="checkbox"]')].map(cb => cb.click()), 3000) This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!

I got 0.087 with firefox but subsequent tries are all in the 0.3-0.8 range.

Re: Checkbox Olympics

#32
post #25

$('.readyButton').click(); setTimeout(()=> [...document.querySelectorAll('input[type="checkbox"]')].map(cb => cb.click()), 3000) This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!

0.012 in Edge

Re: Checkbox Olympics

#35
post #25

$('.readyButton').click(); setTimeout(()=> [...document.querySelectorAll('input[type="checkbox"]')].map(cb => cb.click()), 3000) This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!

I wonder how much of the time is spent in the onclick handler. Each of those clicks has to wait for the onclick handler before the next one executes, IIUC?

Re: Checkbox Olympics

#36

r/mildlyinteresting, but would have been better if after the race you were shown your rank among other participants.

considering how people are already gaming/cheating on this, it's useless stats. Sure, you can write code to check for bots and the bots will write code to beat it...and so on

Re: Checkbox Olympics

#39
post #25

$('.readyButton').click(); setTimeout(()=> [...document.querySelectorAll('input[type="checkbox"]')].map(cb => cb.click()), 3000) This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!

setTimeout doesn't guarantee that it will execute exactly after 3000.

  (() => {
    const targ = $(".setGo");
    const targ2 = $(".theSport > div:nth-child(2)");
    const observer = new MutationObserver((mutations, observer) => {
      if (mutations[0]?.target?.classList.contains('going')) {
        targ2.childNodes.forEach(c => c.click());
      }
    });
  
    observer.observe(targ, {
      subtree: false,
      attributes: true
    });
  
    $('.readyButton').click()
  })();
  
This gives me consistent Time: 0.001 in FF. "Time: not yet set" in Edge/Chrome.
Post reply on HN