help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] faster sets project


From: Gwenael Casaccio
Subject: Re: [Help-smalltalk] faster sets project
Date: Fri, 17 Jul 2009 09:45:43 +0200
User-agent: KMail/1.12.0 (Linux/2.6.28-13-generic; KDE/4.2.96; x86_64; ; )

On Friday 17 July 2009 01:17:24 Ralph Boland wrote:
> 2009/7/14 Paolo Bonzini <address@hidden>:
> >> 2)  In GNU Smalltalk Sets already work this way so there is no need
> >> for FasterSets.
> >
> > It's this. :-)
> >
> > Paolo
>
> I downloaded GNU Smalltalk and checked (which I should have done in
> the beginning) and determined that in fact  GNU Smalltalk Sets and
> subclasses (and also Dictionary and its subclasses) do NOT
> avoid element compares during a grow operation!
>
> Thus set and dictionary adds of elements not already in the collection
> can be improved to do on average 14% fewer compares.
> So can I get a response on which of the remaining scenario's proposed
> is  considered the best.
>
> Regards,
>
> Ralph Boland
>
> >> I recently released a project called FasterSets into the Squeak
> >> repository and am trying to get it incorporated into the Squeak (and
> >> Pharo) base image. Pharo looks like a go;  Squeak seems to move a little
> >> slower.
> >>
> >> Meanwhile, my long term plan is to get FasterSets incorporated into all
> >> versions of Smaltalk that I can, including of course, GNU Smalltalk;
> >> hence this posting.
> >>
> >> The Idea behind FasterSets is to not do any element compares during a
> >> Set (or any of its subclasses) grow operation; since during a grow
> >> operation we know all the elements being added to the set are not
> >> already there and so no compares are needed.  In Squeak this
> >> modification results in a reduction in the average number of element
> >> compares during an add: operation of around  14% (min 7% max 21%).
>
> Note that in Squeak  Dictionary is a subclass of Set so this improvement
> applies to Dictionary and its subclasses as well!
>
> >> I see 4 scenarios:
> >>
> >> 1)  GNU Smalltalk does not want FasterSets.  FasterSets affects low
> >> level methods in class Set and its subclasses and can break user classes
> >> that are subclasses of Set and which override these same low level
> >> methods. (In Pharo FasterSets was tested against a number of packages
> >> including Seaside without problems.)
> >>
> >>
> >> 2)  In GNU Smalltalk Sets already work this way so there is no need
> >> for FasterSets.
>
> HA!
>
> >> 3)  FasterSets is a great idea.  But we want a GNU Smalltalk guru to
> >> implement this idea from scratch.  It is a simple idea after all. 
> >> Thanks for the idea though.
> >>
> >> 4)  FasterSets is a great idea.  The originator (me) will create a
> >>      project in GNU
> >>     Smalltalk containing the code.  Note that the version of FasterSets
> >>     to be incorporated into Squeak/Pharo will be under the MIT license
> >> but the version for GNU Smalltalk will be under the GNU license.
> >>     As the creator of the software I can create different licenses
> >>     for different versions.  I will need to sign the GNU Smalltalk
> >> release form. Since I have
> >>     never used GNU Smalltalk some help with testing project releases
> >> will be helpful.  Someone else will do the final integration into GNU
> >> Smalltalk once the project is released.
> >>     This will be a great way for me to become familiar with GNU
> >> Smalltalk.
> >>
> >> I look forward to feedback.
> >>
> >> Ralph Boland
>
> _______________________________________________
> 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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]