Loops, allocations and helping the coder

Just to give you another perspective. My background is engineering, not CS.

Not sure I agree. I think it is a matter of learning how to write performant code. The same lesson could apply in writing performant C (allocating an array once, passing the pointer around, then refilling as needed). In my experience, writing code this way is not particularly clumsy compared to any other style.

If you want to write performant code I think you should have to learn some of the basic best practices to writing good code, knowing a little bit about the software & hardware and why allocation is slow. This post comes to mind.

1 Like