Commit d9ec870
cache-tree: remove use of strbuf_addf in update_one
String formatting can be a performance issue when there are
hundreds of thousands of trees.
Change to stop using the strbuf_addf and just add the strings
or characters individually.
There are a limited number of modes so added a switch for the
known ones and a default case if something comes through that
are not a known one for git.
In one scenario regarding a huge worktree, this reduces the
time required for a `git checkout <branch>` from 44 seconds
to 38 seconds, i.e. it is a non-negligible performance
improvement.
Signed-off-by: Kevin Willford <kewillf@microsoft.com>1 parent 55879bc commit d9ec870
1 file changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
441 | 463 | | |
442 | 464 | | |
443 | 465 | | |
| |||
0 commit comments