On Wed, Feb 21, 2024 at 3:17 PM Jan Beulich <jbeul...@suse.com> wrote: > > #1 by itself is probably enough to counterindicate this kind of > > behavior. Add them together, and I'm inclined to say that we should > > write a policy against such optimizations, without specific > > justifications. > > It's not like I didn't give any justification. So I guess you mean > without better (whatever that means) justification.
Sorry, what I meant was that the policy would have to include a sketch for what sorts of justifications would be acceptable. For instance, here's a justification I would consider for this sort of thing: A. In use-case X, there is hard limit Y on the binary size. For X's configuration, with a reasonably small number of features enabled, we are already close to 90% of the way there. If we were to consistently use this sort of manual code size optimization techniques across the codebase, we could cut down the total size of the code base by 25%. Here's a situation I would absolutely not consider worth it: B. If we consistently use this sort of code size optimization techniques across the codebase, we could cut down the entire size of the codebase by 0.1%. There are no hard limits, we're just trying to generally keep things smaller. Filling our codebase with these sorts of logic puzzles ("Why are we binary or-ing the offset and the length?") makes it more difficult for people to understand the code base and increases the risk of someone making a mistake as they try to change it. For instance, is this change really equivalent, given that previously one of the comparisons had >=? It turns out yes, but only because we filter out situations where the length is 0; what if we were to move things around again, such that we actually can get here with length 0? Making the binary 0.1% smaller is absolutely not worth the cost of that. I'm not sure even 5% would be worth that cost, given that we don't really have any hard limits we're in danger of exceeding (at least that I'm aware of). But a minimum justification for allowing these sorts of things would need to include a concrete prediction of the improvement we would get by applying these sorts of things all over the place; not simply, "in this instance it goes from three to two branches". -George