this post was submitted on 17 Jul 2023
33 points (90.2% liked)

Programming

17450 readers
165 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 2 comments
sorted by: hot top controversial new old
[–] zygo_histo_morpheus@programming.dev 10 points 1 year ago* (last edited 1 year ago)

As a fan of functional programing, it is validating in a way to see the more functional approach being faster. The reason for not wanting to mutate is that it's easier to reason about pure code. Usually this is for the programmers benefit, but it can be good for the compiler too as we see here. Obviously there are many cases where it is faster to mutate (many data structures can benefit from mutation) but there is this general assumption that fp is slower which isn't exactly true either.

[–] janWilejan@kbin.social 2 points 1 year ago

it would be great if they measured the results of opt1_idiomatic with _ => unreachable!(). In theory the compiler would optimize that better than _ => 0.

load more comments
view more: next ›