Hi all,
thank you for the information.
In fact, Alex you are right, I have a nextPutAll: that I should replace.
Cheers,
Jannik
On Apr 28, 2011, at 15:02 , Alexandre Bergel wrote:
> Hi Jannik,
>
>> ===
>> MessageTally spyOn:
>> [ 500 timesRepeat: [
>> | str |
>>
Hi Jannik,
> ===
> MessageTally spyOn:
> [ 500 timesRepeat: [
> | str |
> str := WriteStream on: (String new).
> 9000 timesRepeat: [ str nextPut: $A ]]].
> ===
>
> The result appears after 812 ms, which is a large improvement
On 28.04.2011 12:35, Toon Verwaest wrote:
On 04/28/2011 12:34 PM, Henrik Sperre Johansen wrote:
On 28.04.2011 11:27, Stéphane Ducasse wrote:
may be you could add a bug entry on the cog tracker
stef
It's not a bug, it's a feature.
Cheers,
Henry
That it only works on non-readwrite streams?
IMHO, you would need a stream equivalent of atAll:put: maybe something like
stream next: 900 put: $A.
It would write directly to destination and save a copy versus say
stream nextPutAll: (String new: 900 withAll: $A)
2011/4/28 Toon Verwaest :
> On 04/28/2011 08:35 AM, jannik.laval wrote:
>
On 04/28/2011 12:34 PM, Henrik Sperre Johansen wrote:
On 28.04.2011 11:27, Stéphane Ducasse wrote:
may be you could add a bug entry on the cog tracker
stef
It's not a bug, it's a feature.
Cheers,
Henry
That it only works on non-readwrite streams?
On 28.04.2011 11:27, Stéphane Ducasse wrote:
may be you could add a bug entry on the cog tracker
stef
It's not a bug, it's a feature.
Cheers,
Henry
may be you could add a bug entry on the cog tracker
stef
On Apr 28, 2011, at 12:25 PM, Henrik Sperre Johansen wrote:
> On 28.04.2011 12:12, Toon Verwaest wrote:
>> nextPut: anObject
>>"Primitive. Insert the argument at the next position in the Stream
>>represented by the receiver. Fail i
On 28.04.2011 12:12, Toon Verwaest wrote:
nextPut: anObject
"Primitive. Insert the argument at the next position in the Stream
represented by the receiver. Fail if the collection of this stream
is not an
Array or a String. Fail if the stream is positioned at its end, or
if the
p
tx I prefer that.
On Apr 28, 2011, at 12:17 PM, Henrik Sperre Johansen wrote:
> On 28.04.2011 10:49, Stéphane Ducasse wrote:
>> Henrik
>>
>> you lost me
>>
>>> In the first example, you are making a single string with all A's of size
>>> 9000 repeated 500 times.
>>> In the second example, you a
On 28.04.2011 10:49, Stéphane Ducasse wrote:
Henrik
you lost me
In the first example, you are making a single string with all A's of size 9000
repeated 500 times.
In the second example, you are making 9000 strings with all A's of size 1
repeated 500 times.
Why?
My bad, I misread and th
In the first example, you are making a single string with all A's of size 9000
repeated 500 times.
In the second example, you are making 9000 strings with all A's of size 1
repeated 500 times.
Why?
Because it's not true :) The problem is rather that you are doing
nextPutAll: with a stri
Henrik
you lost me
> In the first example, you are making a single string with all A's of size
> 9000 repeated 500 times.
> In the second example, you are making 9000 strings with all A's of size 1
> repeated 500 times.
Why?
>>> An optimization is to use a Stream. Here is my source cod
On 04/28/2011 08:35 AM, jannik.laval wrote:
First of all, I spy this source code:
MessageTally spyOn:
[ 500 timesRepeat: [
| str |
*str := ''*.
9000 timesRepeat: [ str := str, 'A' ]]].
This is what Joel Spolsky called a "Shlemiel the Paint
:). It can be improved in a number of ways. Instead of atAllPut:, it
should be from:to:put: (so atAllPut: x should be self from: 1 to: self
size put: x), it should do 8 or so at:put:s by hand before starting the
loop, and it should keep a block of 2048 or so for the iteration (less
memory tra
On 28.04.2011 09:30, Andres Valloud wrote:
As a side comment, I do not know if an atAllPut: method I wrote back
in about 2000 or so is still in the image... but if it is not, keep in
mind that you can use something like replaceFrom:to:with:startingAt:
using the receiver as the source of data, d
As a side comment, I do not know if an atAllPut: method I wrote back in
about 2000 or so is still in the image... but if it is not, keep in mind
that you can use something like replaceFrom:to:with:startingAt: using
the receiver as the source of data, duplicating the amount of data
copied each t
Maybe in the last case you also need to send nextPut: instead of
nextPutAll:...
On 4/27/11 23:35 , jannik.laval wrote:
Hi all,
I am playing with MessageTally, and I have a strange result with
prealocation.
Here is my example. I am working on a PharoCore1.3, with a VM4.2.5
First of all, I spy
Hi all,
I am playing with MessageTally, and I have a strange result with prealocation.
Here is my example. I am working on a PharoCore1.3, with a VM4.2.5
First of all, I spy this source code:
MessageTally spyOn:
[ 500 timesRepeat: [
| str |
s
18 matches
Mail list logo