[Newbies] appending Strings

Mariano Abel Coca marianoabelcoca at gmail.com
Fri Oct 3 20:59:42 UTC 2008


I think you must be thinking in #timeToRun.

About that... In VisualAge there are the EsbTracer and EsbSampler, which
allows you to meassure the time that involves every message sent. It's
useful to tune some code... But don't know in Squeak. Any ideas?

Cheers,

-- 
Mariano.

On Fri, Oct 3, 2008 at 5:44 PM, Mark Volkmann <mark at ociweb.com> wrote:

> That reminds me. I know I ran across a method that runs a block and then
> tells you how long it took. Anyone remember what that's called?
>
> On Oct 3, 2008, at 3:09 PM, Mariano Abel Coca wrote:
>
> Just check it by yourself. ;)
>
> |result|
> 100 timesRepeat:
> [ result := String new.
> 4000 timesRepeat: [ result := result, 'abcdefg' ]].
> ^result
>
>
> |writer|
> 100 timesRepeat:
> [ writer := WriteStream on: String new.
> 4000 timesRepeat: [ writer nextPutAll:'abcdefg' ]].
> ^writer contents
> Cheers,
>
> --
> Mariano.
>
>
> On Fri, Oct 3, 2008 at 2:02 PM, Herbert König <herbertkoenig at gmx.net>wrote:
>
>> Hello Mark,
>>
>> Friday, October 3, 2008, 4:52:39 PM, you wrote:
>>
>> MV> Is there a reason to prefer one of these approaches over the other?
>> MV> Maybe one is more efficient and should be preferred if doing a large
>> MV> number of appends.
>>
>> speed is the reason for the stream approach. The #, approach copies
>> the first string once for each #, send.
>>
>>
>> MV> Are there other approaches I should consider?
>>
>> Don't know of any but then I'm not an expert.
>>
>>
>> Cheers,
>>
>> Herbert
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
>
>
>  _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
> ---
> Mark Volkmann
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20081003/faacc8fd/attachment.htm


More information about the Beginners mailing list