I like this video with it.
- 0 Posts
- 11 Comments
That’s why I hate Ferris wheels. Every time.
Sorry. I wasn’t clear. If the conditional is constant a compile time you get the dead code optimization. The path not taken is removed. If it’s not constant at you may get the loop invariant movement. But only if the compiler can tell that it’s invariant.
My point wasn’t that you should always rely on this behavior. At least, I didn’t mean to say that. I suppose what I should have said is more like “in many cases you won’t see any performance difference because the compiler will do that for you anyway.”
I suppose I have value judgements around that like “generally you should do the thing that is more readable and let the compiler take care of stuff like moving the loop invariant”. That’s been mostly true for me. But only mostly.
I don’t believe you have to specify the condition at compile time. I think that optimization would fall under dead code elimination.
For the invariant code motion stuff the comparison just has to be invariant from start to finish. At least, that’s been my experience. The compiler will just shift the if stement.
But, like, there are totally times when it can’t figure out that the thing is invariant. And sometimes it’s just more readable to move the if statement out of the loop.
I’m reasonably sure compilers can shift the if out. I believe it’s called “loop invariant code motion”. Won’t work in call cases, but in the variable case it should.
nik9000@programming.devto
Programming@programming.dev•What got you into coding ? (aside from money)
3·3 years agoI’m bad at everything else.
nik9000@programming.devto
Programming@programming.dev•What's the latest project you discovered that made you go "wow"?
6·3 years agoThe last project I fell in love with was Elasticsearch. About ten years ago. I was building a search and everything was wrong with solr. I switched to elasticsearch and it was smooth. They had built so much of what I needed. And at the time they were apache licensed which was amazing for us. The world’s kind of moved a long way since then. I’d love to fall in love like that again. I just don’t haveany opportunities.
nik9000@programming.devto
Game Development@programming.dev•Pistol Shrimp and the importance of owning what you make
1·3 years agoI’d love a timeline reset! I need more Orz in my life.
nik9000@programming.devto
Programming@programming.dev•The only thing doing tech tests has taught me is that I'm too stupid to do the job I've been doing professionally for the better part of 2 decades.
61·3 years agoWe ask algorithm questions and I feel bad about it. But a nontrivial portion of the job really is adapting these algorithms to novel scenarios. Not most of the job, but maybe the hardest part.
nik9000@programming.devto
Programming@programming.dev•What would it take for you to move away from Github?
2·3 years agoI use it for work so to entirely leave it they’d have to move away. That seems unlikely.


Zombies!