{"thread":{"id":"14971","subject":"[PATCH 0/2] Speed up xdiff_outf, and therefore git blame","startedAt":"2008-08-13T07:04:01Z","lastAt":"2008-08-13T07:04:01Z","messageCount":1,"participants":["Brian Downing"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"87014","messageId":"20080813070401.GA4396@lavos.net","threadId":"14971","inReplyTo":null,"subject":"[PATCH 0/2] Speed up xdiff_outf, and therefore git blame","fromName":"Brian Downing","fromEmail":"bdowning@lavos.net","sentAt":"2008-08-13T07:04:01Z","receivedAt":"2008-08-13T07:04:01Z","isPatch":true,"sender":{"key":"bdowning@lavos.net","avatar":"https://avatars.githubusercontent.com/u/366426?v=4"},"body":"When using git gui blame on some files in one of my repositories, and\nnoticing some rather depressing performance, I decided to look for some\nlow-hanging fruit to optimize.\n\nI found that a lot of the time is spent in xdiff_outf continually\nxreallocing and freeing memory for a string.  I decided to replace that\nwith a strbuf.  Unfortunately this now means that there are resources\nthat need to be freed after using xdiff_outf, so a new interface for\ndoing that needed to be created first.\n\nThe performance difference on my repository is not amazing, but quite\nnoticeable.  Before:\n\n:; time git blame -M -C -C -p --incremental server.c >/dev/null\n101.52user 0.17system 1:41.73elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k\n0inputs+0outputs (0major+39561minor)pagefaults 0swaps\n\nAfter:\n\n:; time git blame -M -C -C -p --incremental server.c >/dev/null\n80.38user 0.30system 1:20.81elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k\n0inputs+0outputs (0major+50979minor)pagefaults 0swaps\n\nObviously, it should improve other uses of xdiff_outf as well, though I\ndoubt many things hit it as hard as blame does.\n\n [PATCH 1/2] Make xdiff_outf_{init,release} interface\n [PATCH 2/2] Use strbuf for struct xdiff_emit_state's remainder\n\n builtin-blame.c   |    4 ++--\n combine-diff.c    |    4 ++--\n diff.c            |   20 ++++++++++----------\n xdiff-interface.c |   44 ++++++++++++++++++++++----------------------\n xdiff-interface.h |    6 ++++--\n 5 files changed, 40 insertions(+), 38 deletions(-)\n\n-bcd\n"}]}