[squeak-dev] The Inbox: Collections-cbc.810.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Mon Oct 29 19:36:24 UTC 2018
Is Interval = Array such an important feature?
My opinion now is that we should rather abandon it.
Le lun. 29 oct. 2018 à 01:16, <commits at source.squeak.org> a écrit :
> Chris Cunningham uploaded a new version of Collections to project The
> Inbox:
> http://source.squeak.org/inbox/Collections-cbc.810.mcz
>
> ==================== Summary ====================
>
> Name: Collections-cbc.810
> Author: cbc
> Time: 28 October 2018, 5:15:56.960512 pm
> UUID: 729c4dd2-f677-3c40-9ded-4a407a71f824
> Ancestors: Collections-topa.809
>
> Do NOT move to trunk!
> Various option for fixing the internval hash issue related to
> collectionsTests cbc.296.
>
> Some explanation to go to mailing list - this is so interested folks can
> try out the code.
>
> =============== Diff against Collections-topa.809 ===============
>
> Item was added:
> + ----- Method: Array>>hashBetterFastIntervalCompatible (in category
> 'comparing') -----
> + hashBetterFastIntervalCompatible
> + | hash |
> + self size < 48 ifTrue: [^super hash]. "Just check every element."
> + hash := self species hash.
> + 1 to: 16 do: [:i| hash := (hash + (self at: i) hash) hashMultiply].
> + self size - 15 to: self size do: [:i| hash := (hash + (self at: i)
> hash) hashMultiply].
> + ^(hash + self size hash) hashMultiply!
>
> Item was added:
> + ----- Method: Array>>hashFastIntervalCompatible (in category
> 'comparing') -----
> + hashFastIntervalCompatible
> + self size = 0 ifTrue: [^self species hash].
> + ^(self species hash +
> + (((((self at: 1) hash bitShift: 2)
> + bitOr: (self at: self size) hash)
> + bitShift: 1)
> + bitOr: self size)
> + ) hashMultiply!
>
> Item was changed:
> ----- Method: Interval>>hash (in category 'comparing') -----
> hash
> "Hash is reimplemented because = is implemented."
>
> ^(((start hash bitShift: 2)
> bitOr: stop hash)
> bitShift: 1)
> bitOr: self size!
>
> Item was added:
> + ----- Method: Interval>>hashBetter (in category 'comparing') -----
> + hashBetter
> + "Hash is reimplemented because = is implemented."
> +
> + ^(((start hash bitShift: 2)
> + bitOr: self last hash)
> + bitShift: 1)
> + bitOr: self size!
>
> Item was added:
> + ----- Method: Interval>>hashBetterAlsoFixBug3380 (in category
> 'comparing') -----
> + hashBetterAlsoFixBug3380
> + "Hash is reimplemented because = is implemented."
> + "Altered so that we has the same as self asArray hash"
> + ^self inject: Array hash into: [:workingHash :each| (workingHash +
> each hash) hashMultiply ].!
>
> Item was added:
> + ----- Method: Interval>>hashBetterFastArrayCompatible (in category
> 'comparing') -----
> + hashBetterFastArrayCompatible
> + | hash |
> + self size < 48 ifTrue: [^self slowHash]. "Just check every
> element."
> + hash := Array hash.
> + 1 to: 16 do: [:i| hash := (hash + (self at: i) hash) hashMultiply].
> + self size - 15 to: self size do: [:i| hash := (hash + (self at: i)
> hash) hashMultiply].
> + ^(hash + self size hash) hashMultiply!
>
> Item was added:
> + ----- Method: Interval>>hashFastArrayCompatible (in category
> 'comparing') -----
> + hashFastArrayCompatible
> + "Hash is reimplemented because = is implemented."
> + self size = 0 ifTrue: [^Array hash].
> + ^(Array hash +
> + ((((start hash bitShift: 2)
> + bitOr: self last hash)
> + bitShift: 1)
> + bitOr: self size)
> + ) hashMultiply!
>
> Item was added:
> + ----- Method: Interval>>hashSlowerBetterAlsoFixBug3380 (in category
> 'comparing') -----
> + hashSlowerBetterAlsoFixBug3380
> + "Hash is reimplemented because = is implemented."
> + "Altered so that we has the same as self asArray hash"
> + | hash |
> +
> + hash := Array hash.
> + 1 to: self size do: [:i | hash := (hash + (self at: i) hash)
> hashMultiply].
> + ^hash!
>
> Item was added:
> + ----- Method: Interval>>slowHash (in category 'comparing') -----
> + slowHash
> + "Hash is reimplemented because = is implemented."
> + "Altered so that we has the same as self asArray hash"
> + ^self inject: Array hash into: [:workingHash :each| (workingHash +
> each hash) hashMultiply ].!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181029/a562a0a7/attachment.html>
More information about the Squeak-dev
mailing list
|