[ENH] 33% faster macroBenchmark1 and method prettyprinting.

Lex Spoon lex at cc.gatech.edu
Sun Oct 14 18:45:37 UTC 2001


> I note that SortedCollection already needs some work to reimplement
> #copyFrom:to: etc to deal with the sortBlock instvar. And just how can
> we implement SortedCollection>reversed? 

That one's easy -- replace the sortBlock with:

	[ :x :y | (sortBlock value: x value: y) not ]


> Or #copyReplaceFrom:to:with: ?


Er, that's trickier.  The default should be okay, however, so long as a
resort occurs after the replacement.


Overall, I must say that treating SortedCollection as indexable is a bit
odd.  Does anyone ever take advantage of this?  It causes performance
problems, and it causes logical problems like the above, and overall it
just seems like more effort than it's really worth.

Whenever I want sorted elements that I will then fudge with, I tend to
convert the sorted collection to an array, first, just so that I don't
have to worry about what the re-sorts might do.

-Lex




More information about the Squeak-dev mailing list