frustrations in de-slowifying code.

David T. Lewis lewis at mail.msen.com
Sat Mar 20 14:58:00 UTC 2004


On Sat, Mar 20, 2004 at 02:36:57AM -0500, Alan Grimes wrote:
> om
> 
> I have been working on my retina emulator and have gotten to the point 
> of optomizing it...

He Alan,

I assume you are aware of the TimeProfileBrowser... if not, that should
absolutely be your next step. See <http://minnow.cc.gatech.edu/squeak/2133>.

> I've hit several frustrations:
> 
> 1. making revisions that would seem to combine the jobs of a 4 second 
> method with a 5 second method removing one of the loops and the creation 
> of a large array in the process produced a 15 second method... =\
> 
> 2. The run-times are _EXTREMELY_ variable. said 15 second method 
> sometimes takes as long as 5 _MINUTES_.

If your image is getting big enough to generate paging activity in your
operating system, you will see severe performance problems. I don't know
what OS you are using, but for example on Linux you could use xosview to
get a good idea of what is going on with swapping in the OS, and in
your Squeak image use world menu->help->VM statisics to look at your
object memory.

> 4. I noticed that there is a primitive called "matrix 3x3 multiply" 
> which _DOES NOT_ do the textbook matrix multiplication but rather a 
> 3-part vector multiply with some other computations. This could 
> eliminate most of the code in my 19.5 second method. However, I don't 
> fully understand primatives. It seems that once a primative is called it 
> takes over a method and has access to all of its parameters (though this 
> is not completely obvious).
> 
> It would be amazingly useful to have a primitive tutorial and refferance 
> manual...

There is some reasonable information on the Swiki, but based on what
you described, you do not need a primitive. At least not yet. There may
be things you can change in your Squeak code that would give you an
order of magnitude improvement before you have to think about writing
a primitive.  After that, you will be able to see (with the TimeProfileBrowser)
how much improvement you might expect to get out of writing a primitive,
and whether it would be worth your time and effort.

Dave




More information about the Squeak-dev mailing list