Re:Decreasing the Number of Memory Accesses 1/2
by dspillett on Friday March 31, 2023 @07:26AM
(#35385403)
> For developers separated code is easier to read and to maintain.
Unless the inner loop is something long or complicated (in which case for reading & maintainability it should maybe be broken down into functions), I generally find the fused version easier for both.
For readability: it is immediately obvious that everything is working on exactly the same data, and the same range within that data, and that one section is not expected to have side effects that affect the running of the subsequent ones.
For maintainability: there are less possibilities of an edit to one part that should affect all being missed elsewhere.
Unless the inner loop is something long or complicated (in which case for reading & maintainability it should maybe be broken down into functions), I generally find the fused version easier for both.
For readability: it is immediately obvious that everything is working on exactly the same data, and the same range within that data, and that one section is not expected to have side effects that affect the running of the subsequent ones.
For maintainability: there are less possibilities of an edit to one part that should affect all being missed elsewhere.