[ENH] HashCollisionsCheck v3

Stephan Rudlof sr at evolgo.de
Mon Aug 26 14:02:43 UTC 2002


Some corrections and improvements (see 'History' below).

"Change Set:		HashCollisionsCheck v3
Date:
		26 August 2002
Author:
		Stephan Rudlof

The provided methods check instances of Set for potential hash problems.

Inspect:
	Set findHashCollisions
	Set findHashCollisionsModuloCapacity

(Set class)>>findHashCollisions computes raw hash collisions, (Set
class)>>findHashCollisionsModuloCapacity computes collisions resulting after
hash \\ capacityOfSet.
The latter computes the collisions arising in the *current* implementation
of Sets: it illuminates potential problems steming from patterns in the hash
distribution.

Results are returned as aSortedCollection of associations;
(Set class)>>findHashCollisions
	#((collisions/size) size capacity) -> instanceOfSetWithCollisions
,
(Set class)>>findHashCollisionsModuloCapacity
	#((collisionsModuloCapacity/size) size capacity) -> instanceOfSetWithCollisions
.
In (collisionsModuloCapacity/size) size is a better divisor as capacity (the
size of the array used to store the to be hashed items), since we want to
know the collisions related to the number of items to be hashed for the Set.

History:
v3:
semantic change:
		(Set class)>>findHashCollisionsModuloCapacity returns
(collisionsModuloCapacity/size)
			instead of (collisionsModuloCapacity/capacity) in the result;
	preamble corrected;
	(object oriented) refactoring: much of the functionality moved to the
instance side.
v2: Lex Spoon's suggestions incorporated.
v1: initial version with 'raw' hash collisions.
"
-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HashCollisionsCheck.3.cs.gz
Type: application/x-gunzip
Size: 1377 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020826/d2f7b5c6/HashCollisionsCheck.3.cs.bin


More information about the Squeak-dev mailing list