[Python-Dev] Make str/bytes hash algorithm pluggable?

Antoine Pitrou solipsis at pitrou.net
Thu Oct 3 20:50:33 CEST 2013

On Thu, 03 Oct 2013 20:42:28 +0200
Christian Heimes <christian at python.org> wrote:
> I haven't actually benchmarked how a faster hash algorithm
> affects the a real program, though ...

Chances are it doesn't. Only a "slow enough" hash algorithm might have
an impact, IMHO.

> On which level should Python support a pluggable hash algorithm?
> 1) Compile time option: The hash code is compiled into Python's core.
> Embedders have to recompile Python with different options to replace the
> function.

Not much point IMHO. Embedders can patch Python if they really need

> 2) Library option: A hash algorithm can be added and one avaible hash
> algorithm can be set before Py_Initialize() is called for the first
> time.

Too complicated. The library option should only offer the option to
replace the hash algorithm, not "add an available algorithm".

> 3) Startup options: Like 2) plus an additional environment variable and
> command line argument to select an algorithm. With a startup option
> users can select a different algorithm themselves.

-0.9. I think it's overkill.



More information about the Python-Dev mailing list