Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
lysdexic ( lysdexic@programming.dev )  to Programming@programming.devEnglish · 3 years ago

Push Ifs Up And Fors Down

matklad.github.io

external-link
message-square
22
link
fedilink
  • cross-posted to:
  • hackernews@derp.foo
39
external-link

Push Ifs Up And Fors Down

matklad.github.io

lysdexic ( lysdexic@programming.dev )  to Programming@programming.devEnglish · 3 years ago
message-square
22
link
fedilink
  • cross-posted to:
  • hackernews@derp.foo
A short note on two related rules of thumb.
  • pipe01 ( pipe01@lemmy.pipe01.net ) 
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    You still need to read the variable in each iteration, but the cost of that is probably negligible

    • Ryan ( declination@programming.dev ) 
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 years ago

      Modern optimizing compilers are magical. I would need to check assembly but I would actually expect the if to be hoisted out of the loop entirely to relieve pressure on the branch predictor.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

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



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 209 users / day
  • 653 users / week
  • 1.83K users / month
  • 4.43K users / 6 months
  • 452 local subscribers
  • 29.1K subscribers
  • 3.05K Posts
  • 23.6K Comments
  • Modlog
  • mods:
  • snowe ( snowe@programming.dev ) 
  • Ategon ( Ategon@programming.dev ) 
  • UlrikHD ( UlrikHD@programming.dev ) 
  • bugsmith ( bugsmith@programming.dev ) 
  • Spyro ( Spyro@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code