diff options
author | Rafael Silva <rafaeloliveira.cs@gmail.com> | 2021-02-17 15:54:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-17 11:04:17 -0800 |
commit | 8e16effe97f9963a77aa977a38318d8a50d96312 (patch) | |
tree | 4f46511642aaa737081e70d9574e251379e248ad /Documentation/config/versionsort.txt | |
parent | Merge branch 'tb/ci-run-cocci-with-18.04' into maint (diff) | |
download | tgif-8e16effe97f9963a77aa977a38318d8a50d96312.tar.xz |
blame: remove unnecessary use of get_commit_info()
When `git blame --color-by-age`, the determine_line_heat() is called to
select how to color the output based on the commit's author date. It
uses the get_commit_info() to parse the information into a `commit_info`
structure, however, this is actually unnecessary because the
determine_line_heat() caller also does the same.
Instead, let's change the determine_line_heat() to take a `commit_info`
structure and remove the internal call to get_commit_info() thus
cleaning up and optimizing the code path.
Enabling Git's trace2 API in order to record the execution time for
every call to determine_line_heat() function:
+ trace2_region_enter("blame", "determine_line_heat", the_repository);
determine_line_heat(ent, &default_color);
+ trace2_region_enter("blame", "determine_line_heat", the_repository);
Then, running `git blame` for "kernel/fork.c" in linux.git and summing
all the execution time for every call (around 1.3k calls) resulted in
2.6x faster execution (best out 3):
git built from 328c109303 (The eighth batch, 2021-02-12) = 42ms
git built from 328c109303 + this change = 16ms
Signed-off-by: Rafael Silva <rafaeloliveira.cs@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/config/versionsort.txt')
0 files changed, 0 insertions, 0 deletions