[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Faster Sets and GST version 3.0.3
From: |
Ralph Boland |
Subject: |
[Help-smalltalk] Faster Sets and GST version 3.0.3 |
Date: |
Fri, 17 Jul 2009 10:43:37 -0600 |
In version 3.0.3 of gst that I apt-got from Ubuntu 9.04
in HashedCollection I get the code:
findElementIndex: anObject [
"anObject is the content of an indexed variable. See what slot it should
be inserted in."
<category: 'private methods'>
^self findIndex: anObject
The above method is NOT overwritten by Set. Then in Set I find:
findIndex: anObject [
"Tries to see if anObject exists as an indexed variable. As soon as nil
or anObject is found, the index of that slot is answered"
<category: 'private methods'>
| index size element |
self beConsistent.
"Sorry for the lack of readability, but I want speed... :-)"
index := (anObject hash scramble bitAnd: (size := self primSize) - 1) +
1.
[((element := self primAt: index) isNil or: [element = anObject])
ifTrue: [^index].
index == size ifTrue: [index := 1] ifFalse: [index := index + 1]]
repeat
]
So the offending compares are in gst 3.0.3.
Obviously I am using an outdated version of gst and the most recent
version avoids the unnecessary compares.
Great, one less task for me to do.
>> _______________________________________________
>> help-smalltalk mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/help-smalltalk
> May be you can look at HashedCollection (the superclass of Dictionary and Set)
>
> addWhileGrowing: value [
> "Private - Add the newObject association to the receiver. Don't check
> for
> the set to be full - we want SPEED!."
>
> <category: 'private methods'>
> self primAt: (self findElementIndex: value) put: value.
> tally := tally + 1.
> ^value
> ]
>
> (I use the GIT version of GST)
>
> Cheers,
> Gwenael
>
>
> --
>
> VisualGST for GNU Smalltalk : http://visualgst.bioskop.fr/
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Paolo Bonzini <address@hidden>
> To: Gwenael Casaccio <address@hidden>
> Date: Fri, 17 Jul 2009 09:49:30 +0200
> Subject: Re: [Help-smalltalk] faster sets project
>
>> May be you can look at HashedCollection (the superclass of Dictionary and
>> Set)
>>
>> addWhileGrowing: value [
>> "Private - Add the newObject association to the receiver. Don't check
>> for
>> the set to be full - we want SPEED!."
>>
>> <category: 'private methods'>
>> self primAt: (self findElementIndex: value) put: value.
>> tally := tally + 1.
>> ^value
>> ]
>
> findElementIndex: anObject [
> "Tries to see where anObject can be placed as an indexed variable.
> As soon as nil is found, the index of that slot is answered.
> anObject also comes from an indexed variable."
>
> <category: 'private methods'>
> | index size element |
> self beConsistent.
>
> "Sorry for the lack of readability, but I want speed... :-)"
> index := (anObject hash scramble bitAnd: (size := self primSize) - 1)
> + 1.
>
> [(element := self primAt: index) isNil
> ifTrue: [^index].
> index == size ifTrue: [index := 1] ifFalse: [index := index + 1]]
> repeat
> ]
>
>
>> (I use the GIT version of GST)
>
> I think this has been there for years.
>
> (Ralph, no offense intended of course. I understand the difficulty in
> reading a complex system and I understand you are used to having a browser.
> Luckily it's just a few months away... ;-)
No offence taken.
Great to here of the upcoming browser.
I want to learn GST someday; having a browser will help.
>
> Paolo
>
>
>
Regards,
Ralph Boland
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-smalltalk] Faster Sets and GST version 3.0.3,
Ralph Boland <=