On 10/04/07, Bert Freudenberg bert@freudenbergs.de wrote:
On Apr 10, 2007, at 23:50 , Ian Oversby wrote:
On 10/04/07, Bert Freudenberg bert@freudenbergs.de wrote:
On Apr 10, 2007, at 23:22 , Ian Oversby wrote:
Okay, I tried this and it still seems a bit slow:
| myFile ios |
ios := ReadWriteStream on: ''.
Transcript show: 'Populate Buffer: ', (Time millisecondsToRun: [ 1 to: 10000 do: [ :x | ios nextPutAll: ((x asString) ,
String crlf)
]]) asString , ' millseconds' ; cr.
Is this the correct way to use the stream?
Why not write
1 to: 10000 do: [:x | ios print: x; cr]
- Bert -
I don't know the difference between print: and nextPutAll:,
Select "print:", press Cmd-m.
but cr didn't put the correct line ending for Windows, and it still seems equally slow.
Well, that's about as fast as you get without specific optimizations. Most probably Perl uses a C function for formatting numbers, Squeak does not. If this is mission-critical for your app it can be optimized, but in general we choose flexibility over raw speed.
Okay, thanks. That clarifies things a lot.
Cheers for your help Bert,
Ian