[ENH] SpeedTalkingStreams([sm][et] works on x86 machines)

Karl Ramberg karl.ramberg at chello.se
Thu Aug 28 12:59:20 UTC 2003



Joshua 'Schwa' Gargus wrote:
> 
> On Thu, Aug 28, 2003 at 09:58:45AM +0200, Karl Ramberg wrote:
> >
> >
> > Boris Gaertner wrote:
> > >
> > > Joshua 'Schwa' Gargus <schwa at cc.gatech.edu> wrote:
> > >
> > > > from preamble:
> > > > I got a 30x speed improvement on this
> > > > benchmark.
> > > This is impressive!
> > >
> > > (This time with tags as Joshua recommended.)
> > >
> > > I did the test on a 80486 with Squeak 3.6 beta.
> > > As Joshua pointed out, it would be nice to have a test on
> > > a big-endian machine.
> > Got these numbers from the [refStream nextPut: floats] timeToRun.
> > 9362  before filing in the change set.
> > 3038  after.
> 
> Really?  And the float array was the same size?  You must have created
> a new stream before writing the floats again, otherwise it would have
> just appended a reference instead of writing the words, and would have
> been much faster.  (scratches head)
> 
> The 9 seconds timing is pretty much in line with mine; it takes 1.2
> seconds on my 2GHz P4.  Despite this, I stepped through part of an
> invocation of the old code, and didn't see anything that would be
> sped up greatly by being on a big-endian machine.  Therefore, my guess
> is that it is the new code not giving as much of a speed-up, rather
> than the old code being faster.  But I can't imagine why this would
> be.  Could you send results of a MessageTally?
> 
It's most likely some mistake I made...
How should I run this benchmark ?
Select each line and doIt/ printIt ?
Run it and keep the Workspace temp 'floats' for use again after filing
in ?

floats _ (1 to: 100000) collect: [:ignore | (101 atRandom / 61 atRandom)
asFloat].
floats _ FloatArray withAll: floats.
binStream := RWBinaryOrTextStream on: ''.
binStream binary.
refStream := ReferenceStream on: binStream.
[refStream nextPut: floats] timeToRun. 
refStream close.

contents := binStream contents.
binStream := RWBinaryOrTextStream with: contents.
binStream position: contents size. binStream reset.
refStream := ReferenceStream on: binStream.
[refStream next = floats] assert.
refStream close.

Karl



More information about the Squeak-dev mailing list