path: root/pretty.c
diff options
authorRené Scharfe <>2009-01-20 04:30:30 (GMT)
committerJunio C Hamano <>2009-01-20 05:34:46 (GMT)
commit2c2dc7c82cea66c5030583233c73593e0f5a8fdb (patch)
tree1c3d0d5ac36121ab6805295d77f32331cba11c1a /pretty.c
parentc002922adce90b69ac56a86eeb77b249afa88eb2 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'pretty.c')
0 files changed, 0 insertions, 0 deletions