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

Programmer Humor

27248 readers
1203 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] zea_64@lemmy.blahaj.zone 20 points 5 days ago (1 children)

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

[–] sus@programming.dev 13 points 5 days ago (2 children)

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 4 points 4 days ago* (last edited 4 days 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 5 days ago (1 children)

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

[–] ulterno@programming.dev 1 points 5 days ago

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