The example is very slow work with a string.
Code: Select all
DisableDebugger
Str.s
#Text = "1234567890"
Time = ElapsedMilliseconds()
For i=1 To 100000
Str + #Text
Next i
MessageRequester("", StrF((ElapsedMilliseconds()-Time)/1000, 3))
Code: Select all
DisableDebugger
*Str = AllocateMemory(10)
Len = 10
Pos = 0
#Text = "1234567890"
Time = ElapsedMilliseconds()
For i=1 To 100000
Size = StringByteLength(#Text)
If Pos+Size+4>Len
Len+Size+4
*Str = ReAllocateMemory(*Str, Len)
EndIf
Pos+PokeS(*Str+Pos, #Text, Size)
Next i
EnableDebugger
Result.f = (ElapsedMilliseconds()-Time)/1000
ShowMemoryViewer(*Str, Len)
MessageRequester("", StrF(Result, 3))
If the in beginning of the string to keep it length and not be calculated for each access to the string, it should increase performance.