Set asArray method

Cees De Groot cdegroot at gmail.com
Mon Oct 17 07:59:01 UTC 2005


Tim answered this nicely, but just to drive the point home:

On 10/17/05, Ralph Boland <rpboland at gmail.com> wrote:
> 1)  For me the cost of the extra code was worth the gain in
> efficientcy (I believe;
>      I didn't actually do any measurements).

Never just believe something - always measure. There's a profiler in
Squeak, learn to use it. In your case, running:

| set |
"fill set here with some objects"
...
TimeProfileBrowser onBlock: [ 100 timesRepeat: [set asArray]].

with the old and the new code would have told you what the
differences, if any, are between the existing code and your code.

Also, optimization is one thing, but the trade-off between
optimization and maintenance needs to be made on very careful
judgements. I will never ever make my code less maintainable without
very hard evidence that my clean, maintainable code will actually have
a real-world negative performance impact.

Last, as this one showed you: tread carefully in the collections hierarchy :)



More information about the Squeak-dev mailing list