Re:Checkbox Olympics
by msoad on Tuesday June 21, 2022 @07:10AM
(#31822562)
This gives me 0.143 in Safari which is just a proof that DOM is freaking slow haha!
[ Parent
| on HN ]
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.Today I learned. Thank you!
Re:Checkbox Olympics
by alarmingfox on Tuesday June 21, 2022 @07:44AM
(#31822790)
Wow in Chrome 102.0.5005.115 (Official Build) (arm64) it gives me 3.273s which proves that point even more
Hopefully you forgot to exclude 3sec timeout from that
I got 0.087 with firefox but subsequent tries are all in the 0.3-0.8 range.
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
by martini333 on Tuesday June 21, 2022 @08:12AM
(#31822951)
0.012 in Edge