[ENH] HashCollisionsCheck
Stephan Rudlof
sr at evolgo.de
Wed Aug 21 19:20:30 UTC 2002
To be productive:
"Change Set: HashCollisionsCheck
Date:
21 August 2002
Author:
Stephan Rudlof
The provided method checks instances of Set for potential hash problems.
Results are returned as a collection of associations
(collisions/size)->instanceOfSetWithCollisions
."
The results for my system are tranquilizing...
Greetings,
Stephan
--
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 --------------
'From Squeak3.2 of 11 July 2002 [latest update: #4952] on 21 August 2002 at 9:14:13 pm'!
"Change Set: HashCollisionsCheck
Date: 21 August 2002
Author: Stephan Rudlof
The provided method checks instances of Set for potential hash problems. Results are returned as a collection of associations
(collisions/size)->instanceOfSetWithCollisions
."!
!Set class methodsFor: 'checking' stamp: 'sr 8/21/2002 21:06'!
findHashCollisions
"Set findHashCollisions"
| bc |
bc _ [:aSet |
| collisions size collectHashBC |
collectHashBC _ (aSet isKindOf: Dictionary)
ifTrue: [[:aDict | aDict keys collect: [:key | key hash]]]
ifFalse: [[:aSetInner | aSetInner collect: [:e | e hash]]].
(size _ aSet size) > 0
ifTrue:
[collisions _ size - (collectHashBC value: aSet) asSet size.
collisions > 0
ifTrue: [collisions / size -> aSet]]].
^ (self allSubInstances collect: [:aSetOuter | bc value: aSetOuter])
select: [:e | e notNil]! !
!Set class reorganize!
('instance creation' new new: newFrom: sizeFor:)
('initialization' quickRehashAllSets rehashAllSets)
('checking' findHashCollisions)
!
More information about the Squeak-dev
mailing list
|