Re: [PATCH 3/3] introduce "format" date-mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]