480
timeoutSort (lemmy.ml)
you are viewing a single comment's thread
view the rest of the comments
[-] zea_64@lemmy.blahaj.zone 20 points 2 months ago

Wait till you find out how the runtime manages multiple concurrent timers

[-] sus@programming.dev 13 points 2 months ago

it's

while (true) {
    let t = Date.now();
    if (timeoutMap.has(t)) timeoutMap[t]();
}

of course. Clearly O(n).

disclaimerFeel free to use it. I guarantee it is bug free. Comes with express warranty. This notice is legally binding.

[-] FooBarrington@lemmy.world 5 points 2 months ago* (last edited 2 months ago)

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!

[-] yetAnotherUser@lemmy.ca 2 points 2 months ago

Then don't complain once you get arrested...

[-] ulterno@programming.dev 1 points 2 months ago

From nowaday's standards, that's express warranty that lasts until you start executing your code.

this post was submitted on 04 Nov 2025
480 points (99.2% liked)

Programmer Humor

28926 readers
1358 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS