[ENH] SpeedTalkingStreams([sm][et] works on x86 machines)
Joshua 'Schwa' Gargus
schwa at cc.gatech.edu
Thu Aug 28 14:30:53 UTC 2003
On Thu, Aug 28, 2003 at 02:59:20PM +0200, Karl Ramberg wrote:
>
>
> 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 ?
That's how I did it.
> Run it and keep the Workspace temp 'floats' for use again after filing
> in ?
>
I did, but it shouldn't matter. Just to be clear:
"do this once"
floats := (1 to: 100000) collect: [:ignore | (101 atRandom / 61 atRandom) asFloat].
floats := FloatArray withAll: floats.
"select all of this and printIt, before and after filing in"
binStream := RWBinaryOrTextStream on: ''.
binStream binary.
refStream := ReferenceStream on: binStream.
time := [refStream nextPut: floats] timeToRun.
refStream close.
time
Thanks,
Joshua
>
> 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
|