To make String and Symbol ANSI compliant regarding #=

Stephan Rudlof sr at evolgo.de
Mon Apr 17 15:00:48 UTC 2000


"Andrew C. Greenberg" wrote:
> 
> At 1:10 AM +0200 4/17/2000, Stephan Rudlof wrote:
> >"Andrew C. Greenberg" wrote:
> >>
> >>  >- removing #= from String (semantically, means it has to be the same
> >>  >result as SequenceableCollection>>=).
> >>
> >>  Have you benchmarked this one?
> >
> >No, but benchmarks reagarding the removal or change of Symbol>>=
> >; see earlier mails of mine.
> >BTW: It's a damned big thread now!
> 
> Benchmarks regarding removal of Symbol>>= do not inform the question
> of removing String>>=.

I know. I don't want to benchmark all and wanted to say what I *have*
benchmarked (probably to motivate others to benchmark other things).

> These are two different methods entirely,
> working in entirely different ways.

But both methods have dependencies with each other: see
asymmetry/symmetry discussion.

> 
> >  > String>>#= calls a primitive to
> >>  compare string elements.  SequencableCollection loops through the
> >>  interpreter cycle.  I'll bet the costs are substantial for plain
> >>  string-string comparisons.
> >
> >I'll bet the same!
> 
> Why?

A primitive is much more faster. I have some feeling for that, because
of writing the LargeIntegersPlugin dealing with byte oriented data
structures. Just one argument:
The loop in SequenceableCollection calls a prim to access *every*
element itself with #at:, so we have numOfElem prim calls here, it is
		(63 primitiveStringAt)
for Strings and Symbols.

In a primitive in String we have *one* prim call.

There are some optimizations in the interpreter, so it is a somewhat
fuzzy argumentation, but in principle it is so.
If you want to know it better, try it out.


But performance is not the issue IMHO. The ANSI standard refers to the
*semantic* meaning of operations, the implementation is another area. I
think for every *semantic* discussed so far, it shouldn't be a big
problem to write a comparable fast implementation.

But it is important to have a reliable and good defined *semantic*
first!


Greetings,

Stephan

> --
> Andrew C. Greenberg             acg at netwolves.com
> V.P. Eng., R&D,                 813.885.2779 (office)
> Netwolves Corporation           813.885.2380 (facsimile)
> www.netwolves.com

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3





More information about the Squeak-dev mailing list