[Python-checkins] peps: document DJBX33A and discussion about non-aligned memory

christian.heimes python-checkins at python.org
Thu Nov 14 00:20:23 CET 2013


http://hg.python.org/peps/rev/bd98d7a7b946
changeset:   5269:bd98d7a7b946
user:        Christian Heimes <christian at cheimes.de>
date:        Thu Nov 14 00:20:03 2013 +0100
summary:
  document DJBX33A and discussion about non-aligned memory

files:
  pep-0456.txt |  23 ++++++++++++++++++++++-
  1 files changed, 22 insertions(+), 1 deletions(-)


diff --git a/pep-0456.txt b/pep-0456.txt
--- a/pep-0456.txt
+++ b/pep-0456.txt
@@ -237,7 +237,10 @@
 DJBX33A
 -------
 
-TODO
+DJBX33A is a very simple multiplication and addition algorithm by Daniel
+J. Bernstein. It is fast and has low setup costs but it's not secure against
+hash collision attacks. Its properties make it a viable choice for small
+string hashing optimization.
 
 
 Other
@@ -609,6 +612,22 @@
 an unnecessary complication by several core committers [pluggable]_. Subsequent
 versions of the PEP aim for compile time configuration.
 
+Non-aligned memory access
+-------------------------
+
+The implementation of SipHash24 were critized because it ignores the issue
+of non-aligned memory and therefore doesn't work on architectures that
+requires alignment of integer types. The PEP deliberately neglects this
+special case and doesn't support SipHash24 on such platforms. It's simply
+not considered worth the trouble until proven otherwise. All major platforms
+like X86, X86_64 and ARMv6+ can handle unaligned memory with minimal or even
+no speed impact. [alignmentmyth]_
+
+Almost every block is properly aligned anyway. At present bytes' and str's
+data are always aligned. Only memoryviews can point to unaligned blocks
+under rare circumstances. The PEP implementation is optimized and simplified
+for the common case.
+
 
 References
 ==========
@@ -649,6 +668,8 @@
 
 .. [pluggable] https://mail.python.org/pipermail/python-dev/2013-October/129138.html
 
+.. [alignmentmyth] http://lemire.me/blog/archives/2012/05/31/data-alignment-for-speed-myth-or-reality/
+
 
 Copyright
 =========

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


More information about the Python-checkins mailing list