What is your opinion on (conditional) branching in your code?

Conditional branching includes things like (non-trivial) if statements, for statements, etc.

Also, for those of you who haven't heard about this, even though conditional branching is a programming fundamental, it's not great for CPU performance (though a lot of work has gone into improving this to the point where you typically don't have to worry about this with modern CPU hardware and compilers) and there are programming styles which reduce or eschew branching, either for style reasons or to help with performance.

Follow

@urusan
do you mean things like APL/numpy-like array programming? or something else entirely?

@niplav There are a lot of different problem domains and approaches under this umbrella.

I don't know enough about APL to comment on it. As for numpy, you could definitely reframe certain problems that would normally involve lots of branching into a bunch of matrix calculations without branching.

Sign in to participate in the conversation
Mastodon

a Schelling point for those who seek one