this post was submitted on 04 Nov 2025
89 points (98.9% liked)

Programmer Humor

43158 readers
4 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 7 years ago
MODERATORS
top 8 comments
sorted by: hot top controversial new old
[–] owenfromcanada@lemmy.ca 18 points 9 months ago

How does a programming joke cause me physical pain?

[–] LadyMeow@lemmy.blahaj.zone 9 points 9 months ago (2 children)

I mean, it’s basically O(1), right? :p

[–] Ephera@lemmy.ml 14 points 9 months ago (1 children)

I mean, it does scale with the size of the input. Just not with the count of inputs, but rather the size of each input element.

[–] jimmux@programming.dev 5 points 9 months ago (1 children)

Or just the size of the largest input?

[–] Ephera@lemmy.ml 2 points 9 months ago

Oh yeah, I do think setTimeout executes in parallel, so only the largest element determines the execution time. It was difficult enough to make that sentence make sense, so I didn't want to cram that detail in as well. 🙃

[–] marduk@lemmy.sdf.org 4 points 9 months ago
[–] limer@lemmy.ml 6 points 9 months ago

If it is stupid and it works it’s not stupid.

I’m going to use it

[–] Vinapocalypse@lemmy.ml 3 points 9 months ago* (last edited 9 months ago)

PR:

-  setTimeout(() => console.log(item), item)
+  setTimeout(() => console.log(item), Math.log(item))

Comment: This will speed up sort time greatly. However, sort order may become erratic for longer lists, and lists with numbers less than 1