[PATCH] store: rewrite fncache path mangling code in C

Bryan O'Sullivan bos at serpentine.com
Mon Aug 27 17:35:41 CDT 2012


On Mon, Aug 27, 2012 at 2:00 PM, Bryan O'Sullivan <bos at serpentine.com>wrote:

> diff --git a/mercurial/sha1.c b/mercurial/sha1.c
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/sha1.c
>

Someone asked on IRC what the performance implications of this SHA-1 code
were, so I quickly hacked up a version of the path encoding code that calls
the Python sha function.

The all-native encoder can encode 315,000 long names per second. The
version that uses the C API to go through Python can encode 215,000. The
original pure-Python code can only manage 15,000 per second.

In my real-world repo, long names that trigger the slow encoding path make
up 1% of the population. So in my estimation, it's worth having a version
of the slow path in C, but not worth adding the SHA-1 code. I'll send a new
patch without it shortly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120827/3cdb2976/attachment.html>


More information about the Mercurial-devel mailing list