tim at sumeru.stanford.edu
Thu Dec 2 19:24:15 UTC 2004
Ryan Zerby <tahognome at gmail.com> wrote:
> Should I worry about having a program that makes a large number of
> temporary objects?
Not in the sense of having to worry about the system not being able to
cope. VM implementors over the ages have done your worrying for you!
However, it is often the case that a little fiddling with algorithms
can improve things; it's time for you to start using the
TimeProfileBrowser to see where your time goes. Look it up in the
browser and start playing.
> planet position: (Point r: rho degree: theta) + self center.
> This creates a lot of points that get discarded on the next iteration
> of step.
No great problem; the gc will recycle them almost immediately. The time
'wasted' is simply that you might be creating them unneccessarily, say
if the algorithm can be squeezed a bit.
If you have a large number of planets in mind you might even benefit
from the sort of low down underhanded cleverness that Yoshiki has
recently used to do very fast array processing in the cellular automata
morphs. By putting the coordinates into FloatArrays it is possible to
get thousands of cells bouncing around; at least on machines with
floatingpoint hardware like I don't have :-(
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
The program is absolutely right; therefore the computer must be wrong.
More information about the Squeak-dev