On Feb 12, 2007, at 11:15 AM, Norman Palardy wrote:


On Feb 11, 2007, at 11:09 PM, Tom Benson wrote:

RB strings are not mutable...

When you call " s = s + str(i) " a new string is created in memory, the value of the old string plus the new string are added together an placed in the new string, and then the old string is taken out of memory.

Each iteration of this loop will therefore be a little longer than the last, as the string slowly winds it's way up to 50,000 characters long.

Array's are much faster than strings for appends, but I defy you to do an instr or countfields operation on one of your fast strings....

Different horses for different courses Kem....

- Tom

Very true.
A MemoryBlock backed fast string could be mutable, fast and searchable
I think Charles has such a thing in http://declaresub.com/Code/ StringBuffer.sit

But I wouldn't recommend it any more; appending to an array + Join is faster.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to