If I have code like this:
auto builder = appender!string;
builder ~= "Hello, World!";
builder ~= "I'm here!";
builder ~= "Now I'm there!";
the object file grows by 10-11 lines with each call to `builder
~=`. If I use this:
builder ~= format("%s", "Hello, World!");
builder ~= format("%s", "I'm here!");
builder ~= format("%s", "Now I'm there!");
The object file is more than twice as big and it grows by 20
lines with each call to `format`.
If I use
builder ~= format("%s %s %s", "Hello, World!", "I'm here!", "Now
I'm there!");
the code bloat is even worse.
There are many situation where a formatting string is preferable
to concatenation, however it adds _a lot_ of bloat. Would a
custom formatter be preferable to reduce code bloat or should
std/format.d be optimized? (Or both?)
dmd 2.067.1
-release -boundscheck=off -inline -O