[Q] RunArray>>, and #copyReplaceFrom:to:with:

Scott A Crosby crosby at qwes.math.cmu.edu
Wed Oct 17 01:07:21 UTC 2001


On Tue, 16 Oct 2001, Bijan Parsia wrote:

>   copyReplaceFrom: start to: stop with: replacement
>
> 	^(self copyFrom: 1 to: start - 1)
> 		, replacement
> 		, (self copyFrom: stop + 1 to: self size)
>
> Now, I know , can be slow, yadda yadda yadda, but I don't see a simple way
> to use a stream here. I peeked at VisualWorks and it has a bunch of stuff
> to optimize this sort of thing.

Actually, I worked around this about 2 weeks ago (See the 33% faster
macroBenchmark1 post from a while ago).

I assemble the pieces of the sortedCollection by using the array
constructor rather than doing slow add: calls.

So, its still doing basically the same technique, just faster.

I've been criticized for my patch being fragile, I don't have time now to
update it, but it should be good for a 30-50% gain there. Also, look at my
posts of around the same time, where I give several other tricks for
speeding things up.


> So my question is: How interesting is it to optimize this? Browsing
> senders of #addAttribute:from:to: didn't reveal that much to me (is there
> a good way to profile "general use" of a method as I engage in routine
> activities)? I really like Texts but I'm beginning to worry that they

Actually, its used by basically all of the colorizers, for example, the
method prettyprinter, this also accounts for about half of the runtime for
maccroBenchmark1.

> might not be all that nippy (e.g., if I have lots and lots of attributes
> and emphasis, etc.).
>
> Any thoughts, advice, speculations, etc. anyone cares to offer would be
> most welcome.
>

Clean up my patch so it gets accepted, or use the later version as-is, and
enjoy the speed increase.  Also, I have a modified version of the profiler
that makes it a little easier to see this sorta stuff. Also a week/two
ago.


Scott




--
No DVD movie will ever enter the public domain, nor will any CD. The last CD
and the last DVD will have moldered away decades before they leave copyright.
This is not encouraging the creation of knowledge in the public domain.





More information about the Squeak-dev mailing list