On Tue, Jun 30, 2015 at 02:13:53PM -0400, Eric Sunshine wrote:
Sorry, I meant that the interpolation expense of "%s ". A cheaper (but
more verbose) alternative might be:
size_t n = strlen(fmt);
const char *f = xmalloc(n + 2);
strcpy(f, fmt);
f[n] = ' ';
f[n + 1] = '\0';
...
free(f);
or something similar.
I think you're probably getting into premature optimization here. Using
strbuf_vaddf should be within the same order of magnitude of
instructions (and I think we should almost never hit this code path
anyway, because we'll be reading into a static strbuf generally which
will come pre-sized to hold a date).
-Peff