As part of [SR-3340] Evaluate the ABI for existential container storage. · Issue #45928 · apple/swift · GitHub we put the evaluation of the size of the inline buffer on our plate. In the bug I propose to not change it. Data based decision is usually a sensible approach but I claim we don't have the necessary experimental setup (proper benchmarks) to get sensible data a decision can be based on. This might be controversial. My reasoning there:
It is implied in this bug that we have a sensible way of evaluating the decision what size the inline storage should be based on some benchmarks.
I claim we don't have the set of benchmarks available to make a sensible data based decision:
I think for a truly meaning full data base decision we would have to evaluate a representative set of programs against a metric like minimizing heap memory waste vs performance over the dynamic execution of this set of programs. We would need system'y benchmarks (i.e larger applications that model properties of large frameworks or system applications).
I posit that we don't have this set of benchmarks available (our swift/benchmarks certainly don't qualify IMO) nor do we have the time to construct them.
Short of that I think that it is going to be intuition what a good size is based on some sensible rules:
- One that we expect to miminize memory waste and maximizes performance.
- This is going to be around the size where we are today (IMO).
- The size should work well with common standard library types:
- String is going to be two words
- StringSlice is going to be three words
This favors the status quo. The status quo is further favored by the fact that existing applications rely on it implicitly.
What would we get out of an experiment running the benchmarks:
- Assume 2 word buffer regresses unacceptly; then we would argue we have to stay with a 3 word buffer (which is what we are proposing without the experiment).
- Assume it does not; what would be the conclusion. I would not want to move to a 2 word buffer based on this because i don’t believe that the benchmark to be representative of performance or memory requirements in a system setting.