this post was submitted on 08 Jul 2023
27 points (96.6% liked)

Programming

17398 readers
156 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] noneabove1182@sh.itjust.works 7 points 1 year ago (1 children)

Honestly an interesting thought and worth keeping in mind, I would love to see a lot more examples and more timing, especially for the pythonic ones, are they more efficient or just more python like?

[–] ishanpage@programming.dev 3 points 1 year ago (1 children)

OTOH, the more pythonic one will probably perform worse, but I'm not familiar enough with Python internals to make that claim without benchmarks.

I'll try it out and add the data in the article

[–] Hazzard@lemm.ee 4 points 1 year ago (1 children)

Eh, the python one will probably perform better, because sum is probably written in native C under the hood.

[–] jadero@programming.dev 3 points 1 year ago

I've yet to find a language where "doing it yourself" has higher performance than calling the built-in or library function. There are edge cases, but rarely enough to be bothered about.