diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2009-01-19 23:30:30 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-19 21:34:46 -0800 |
commit | 2c2dc7c82cea66c5030583233c73593e0f5a8fdb (patch) | |
tree | 1c3d0d5ac36121ab6805295d77f32331cba11c1a /builtin-apply.c | |
parent | expand --pretty=format color options (diff) | |
download | tgif-2c2dc7c82cea66c5030583233c73593e0f5a8fdb.tar.xz |
Optimize color_parse_mem
Commit 5ef8d77a implemented color_parse_mem, a function for
parsing colors from a non-NUL-terminated string, by simply
allocating a new NUL-terminated string and calling
color_parse. This had a small but measurable speed impact on
a user format that used the advanced color parsing. E.g.,
# uses quick parsing
$ time ./git log --pretty=tformat:'%Credfoo%Creset' >/dev/null
real 0m0.673s
user 0m0.652s
sys 0m0.016s
# uses color_parse_mem
$ time ./git log --pretty=tformat:'%C(red)foo%C(reset)' >/dev/null
real 0m0.692s
user 0m0.660s
sys 0m0.032s
This patch implements color_parse_mem as the primary
function, with color_parse as a wrapper for strings. This
gives comparable timings to the first case above.
Original patch by René. Commit message and debugging by Jeff
King.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-apply.c')
0 files changed, 0 insertions, 0 deletions