From: Ingo Molnar Date: Thu, 28 Apr 2011 20:32:05 GMT Subject: Re: [PATCH] git gc: Speed it up by 18% via faster hash comparisons Message-ID: <20110428203205.GD24755@elte.hu> In-Reply-To: * Erik Faye-Lund wrote: > Thanks. I also timed on my end (on Windows), and I came to the same > conclusion (but the improvements of your original was somewhat smaller in my > end; could be due to the test-case). It seems like the early-out wasn't the > only reason your original patch performed faster. It could be that memcmp > (probably) didn't get inlined, and the extra function call outweighs the > complexity. [...] Function calls arent that heavy really. My measurements identified the following effects: - profiling of stalled cycles clearly pinpointed the REP MOV string instruction. - the patched code had less branch-misses - the clearer and inlined open-coded loop is probably easier for the CPU to speculate along - while REP MOV string ops are 'opaque' and the result might be harder to speculate. So i think the main benefit of my patch is that it avoids the REP MOV instruction. Thanks, Ingo