René Scharfe <l....@web.de> writes:

> The difference is about the same as the one between:
>
>       $ time git log --format="" >/dev/null
>
>       real    0m0.463s
>       user    0m0.448s
>       sys     0m0.012s
>
> and:
>
>       $ time git log --format="%h" >/dev/null
>
>       real    0m1.062s
>       user    0m0.636s
>       sys     0m0.416s
>
> With caching duplicates are basically free and without it short
> hashes have to be looked up again.  Other placeholders may reduce
> the relative slowdown, depending on how expensive they are.

I think the real question is how likely people use more than one
occurrence of the same thing in their custom format, and how deeply
they care that --format='%h %h' costs more than --format='%h'.  The
cost won't of course be double (because the main traversal costs
without any output), but it would be rather unreasonable to expect
that --format='%h %h %h %h %h' to cost the same as --format='%h';
after all, Git is doing more for them ;-)

So in that sense, I am actually OK if we decide to remove the caching.

> Forgot a third option, probably because it's not a particularly good
> idea: Replacing the caching in pretty.c with a short static cache in
> find_unique_abbrev_r().

Indeed.

Reply via email to