cm0002@lemmy.world to Programmer Humor@programming.dev · 9 days agotimeoutSortlemmy.mlimagemessage-square36fedilinkarrow-up1481arrow-down14cross-posted to: [email protected]
arrow-up1477arrow-down1imagetimeoutSortlemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 9 days agomessage-square36fedilinkcross-posted to: [email protected]
minus-squareNat (she/they)@lemmy.blahaj.zonelinkfedilinkarrow-up20·9 days agoWait till you find out how the runtime manages multiple concurrent timers
minus-squaresus@programming.devlinkfedilinkarrow-up13·9 days agoit’s while (true) { let t = Date.now(); if (timeoutMap.has(t)) timeoutMap[t](); } of course. Clearly O(n). disclaimer Feel free to use it. I guarantee it is bug free. Comes with express warranty. This notice is legally binding.
minus-squareyetAnotherUser@lemmy.calinkfedilinkarrow-up2·9 days agoThen don’t complain once you get arrested…
minus-squareulterno@programming.devlinkfedilinkEnglisharrow-up1·8 days agoFrom nowaday’s standards, that’s express warranty that lasts until you start executing your code.
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up5·edit-28 days agoI found a way to optimize your code without affecting the result. By making it branchless, I was able to get my CPU to 100% utilization!
Wait till you find out how the runtime manages multiple concurrent timers
it’s
while (true) { let t = Date.now(); if (timeoutMap.has(t)) timeoutMap[t](); }of course. Clearly O(n).
disclaimer
Feel free to use it. I guarantee it is bug free. Comes with express warranty. This notice is legally binding.
Then don’t complain once you get arrested…
From nowaday’s standards, that’s express warranty that lasts until you start executing your code.
I found a way to optimize your code without affecting the result. By making it branchless, I was able to get my CPU to 100% utilization!