diff options
author | Elijah Newren <newren@gmail.com> | 2020-11-05 00:22:40 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-04 17:09:49 -0800 |
commit | 6ccdfc2a206d8266ad7613999a0d3f6acdf44c89 (patch) | |
tree | bd38936b27b908a589f18c47cc28ceaa9d4c10f2 /t/t4013/diff.noellipses-diff_--raw_--abbrev=4_initial | |
parent | strmap: add more utility functions (diff) | |
download | tgif-6ccdfc2a206d8266ad7613999a0d3f6acdf44c89.tar.xz |
strmap: enable faster clearing and reusing of strmaps
When strmaps are used heavily, such as is done by my new merge-ort
algorithm, and strmaps need to be cleared but then re-used (because of
e.g. picking multiple commits to cherry-pick, or due to a recursive
merge having several different merges while recursing), free-ing and
reallocating map->table repeatedly can add up in time, especially since
it will likely be reallocated to a much smaller size but the previous
merge provides a good guide to the right size to use for the next merge.
Introduce strmap_partial_clear() to take advantage of this type of
situation; it will act similar to strmap_clear() except that
map->table's entries are zeroed instead of map->table being free'd.
Making use of this function reduced the cost of
clear_or_reinit_internal_opts() by about 20% in mert-ort, and dropped
the overall runtime of my rebase testcase by just under 2%.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.noellipses-diff_--raw_--abbrev=4_initial')
0 files changed, 0 insertions, 0 deletions