this post was submitted on 22 Oct 2023
606 points (95.6% liked)

Programmer Humor

32054 readers
1392 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] auf@lemmy.ml 92 points 11 months ago (18 children)

Thief way is actually the best among all of these imo, in terms of readability and efficiency.

[–] platypode@sh.itjust.works 89 points 11 months ago (12 children)

Not using thief is professional incompetence unless you're doing something deeply cursed

[–] Natanael@slrpnk.net 3 points 11 months ago (9 children)

Sometimes you need to minimize function calls in a tight loop, but otherwise yeah

[–] demonen@lemmy.ml 3 points 11 months ago

If you're optimizing that hard you should probably sort the data first anyway, but yeah, sometimes it's absolutely called for. Not that I've actually needed that in my professional career, but then again I've never worked close enough to metal for it to actually matter.

That said, all of these are implemented as functions, so they're already costing the function call anyway...

load more comments (8 replies)
load more comments (10 replies)
load more comments (15 replies)