cm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agotimeoutSortimagemessage-square35linkfedilinkarrow-up1470arrow-down14cross-posted to: programmerhumor@lemmy.ml
arrow-up1466arrow-down1imagetimeoutSortcm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agomessage-square35linkfedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squareNat (she/they)@lemmy.blahaj.zonelinkfedilinkarrow-up20·2 days agoWait till you find out how the runtime manages multiple concurrent timers
minus-squaresus@programming.devlinkfedilinkarrow-up12·2 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-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up3·edit-21 day 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!
minus-squareyetAnotherUser@lemmy.calinkfedilinkarrow-up1·2 days agoThen don’t complain once you get arrested…
minus-squareulterno@programming.devlinkfedilinkEnglisharrow-up1·2 days agoFrom nowaday’s standards, that’s express warranty that lasts until you start executing your code.
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.
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!
Then don’t complain once you get arrested…
From nowaday’s standards, that’s express warranty that lasts until you start executing your code.