[Python-checkins] peps: add benchmark numbers for small string optimization

christian.heimes python-checkins at python.org
Thu Nov 14 16:09:36 CET 2013


http://hg.python.org/peps/rev/90d5a5d88de9
changeset:   5270:90d5a5d88de9
user:        Christian Heimes <christian at cheimes.de>
date:        Thu Nov 14 16:09:27 2013 +0100
summary:
  add benchmark numbers for small string optimization

files:
  pep-0456.txt |  10 ++++++----
  1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/pep-0456.txt b/pep-0456.txt
--- a/pep-0456.txt
+++ b/pep-0456.txt
@@ -9,7 +9,7 @@
 Content-Type: text/x-rst
 Created: 27-Sep-2013
 Python-Version: 3.4
-Post-History: 06-Oct-2013
+Post-History: 06-Oct-2013, 14-Nov-2013
 
 
 Abstract
@@ -267,7 +267,7 @@
 code that can dominate speed of the algorithm for very short strings. On the
 other hand Python calculates the hash value of short strings quite often. A
 simple and fast function for especially for hashing of small strings can make
-a measurably impact on performance. For example these measurements were taken
+a measurable impact on performance. For example these measurements were taken
 during a run of Python's regression tests. Additional measurements of other
 code have shown a similar distribution.
 
@@ -296,7 +296,9 @@
 However a fast function like DJBX33A is not as secure as SipHash24. A cutoff
 at about 5 to 7 bytes should provide a decent safety margin and speed up at
 the same time. The PEP's reference implementation provides such a cutoff with
-``Py_HASH_CUTOFF`` but disables the optimization by default.
+``Py_HASH_CUTOFF`` but disables the optimization by default. Multiple runs of
+Python's benchmark suite shows an average speedups between 3% and 5% for
+benchmarks such as django_v2, mako and etree with a cutoff of 7 on 64 bit Linux.
 
 
 C API additions
@@ -401,7 +403,7 @@
 ``Py_HASH_FNV`` or ``Py_HASH_EXTERNAL``. If ``Py_HASH_ALGORITHM`` is not
 defined at all, then the best available algorithm is selected. On platforms
 wich don't require aligned memory access (``HAVE_ALIGNED_REQUIRED`` not
-defined) and an unsigned 64bit integer type ``PY_UINT64_T``, SipHash24 is
+defined) and an unsigned 64 bit integer type ``PY_UINT64_T``, SipHash24 is
 used. On strict C89 platforms without a 64 bit data type, or architectures such
 as SPARC, FNV is selected as fallback. A hash algorithm can be selected with
 an autoconf option, for example ``./configure --with-hash-algorithm=fnv``.

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list