[squeak-dev] The Trunk: Collections-eem.808.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Oct 22 23:55:07 UTC 2018
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.808.mcz
==================== Summary ====================
Name: Collections-eem.808
Author: eem
Time: 22 October 2018, 4:54:43.989805 pm
UUID: c6b15e95-b365-4ea0-8211-71ec7f55084b
Ancestors: Collections-ul.807
Faster ByteString/ByteArray hashing. The VM will accept either 1 or 2 args for the primitiveStringHash primitive so it can be used on the instance size, avoiding a little overhead.
=============== Diff against Collections-ul.807 ===============
Item was added:
+ ----- Method: ByteArray>>bytesHashWithInitialHash: (in category 'private') -----
+ bytesHashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed array, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^String stringHash: self initialHash: speciesHash!
Item was changed:
----- Method: ByteArray>>hash (in category 'comparing') -----
hash
"#hash is implemented, because #= is implemented"
+ ^self bytesHashWithInitialHash: self species hash!
- ^self class
- hashBytes: self
- startingWith: self species hash!
Item was added:
+ ----- Method: ByteString>>stringHashWithInitialHash: (in category 'private') -----
+ stringHashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^super stringHashWithInitialHash: speciesHash!
Item was added:
+ ----- Method: ByteSymbol>>stringHashWithInitialHash: (in category 'private') -----
+ stringHashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^super stringHashWithInitialHash: speciesHash!
Item was changed:
----- Method: String>>hash (in category 'comparing') -----
hash
"#hash is implemented, because #= is implemented"
"ar 4/10/2005: I had to change this to use ByteString hash as initial
hash in order to avoid having to rehash everything and yet compute
the same hash for ByteString and WideString.
md 16/10/2006: use identityHash as initialHash, as behavior hash will
use String hash (name) to have a better hash soon.
eem 4/17/2017 it's not possible to use String hash (name) for the
initial hash because that would be recursive."
+ ^self stringHashWithInitialHash: ByteString identityHash!
- ^self class stringHash: self initialHash: ByteString identityHash!
Item was added:
+ ----- Method: String>>stringHashWithInitialHash: (in category 'private') -----
+ stringHashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ | hash |
+ hash := speciesHash bitAnd: 16r0FFFFFFF.
+ 1 to: self size do:
+ [:pos |
+ hash := (hash + (self basicAt: pos)) hashMultiply].
+ ^hash!
More information about the Squeak-dev
mailing list
|