[Python-checkins] python/dist/src/Objects tupleobject.c,2.91,2.92

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Jun 4 02:35:35 EDT 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24517

Modified Files:
	tupleobject.c 
Log Message:
Replaced arbitrary addend in tuple_hash with one that is known to generate
many more prime multipliers and that performs well on collision tests.



Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.91
retrieving revision 2.92
diff -C2 -d -r2.91 -r2.92
*** tupleobject.c	1 Jun 2004 06:36:24 -0000	2.91
--- tupleobject.c	4 Jun 2004 06:35:20 -0000	2.92
***************
*** 257,260 ****
--- 257,268 ----
  }
  
+ /* The addend 82520, was selected from the range(0, 1000000) for 
+    generating the greatest number of prime multipliers for tuples 
+    upto length eight:
+ 
+      1082527, 1165049, 1082531, 1165057, 1247581, 1330103, 1082533, 
+      1330111, 1412633, 1165069, 1247599, 1495177, 1577699
+ */
+ 
  static long
  tuplehash(PyTupleObject *v)
***************
*** 271,275 ****
  			return -1;
  		x = (x ^ y) * mult;
! 		mult += 69068L + len + len;
  	}
  	if (x == -1)
--- 279,283 ----
  			return -1;
  		x = (x ^ y) * mult;
! 		mult += 82520L + len + len;
  	}
  	if (x == -1)




More information about the Python-checkins mailing list