[Lazarus] dynamic string proposal

Sven Barth pascaldragon at googlemail.com
Thu Aug 17 14:43:04 CEST 2017


Am 17.08.2017 11:41 schrieb "Michael Schnell via Lazarus" <
lazarus at lists.lazarus-ide.org>:
>
> On 17.08.2017 11:29, Sven Barth via Lazarus wrote:
>>
>> Am 17.08.2017 11:11 schrieb "Michael Schnell via Lazarus" <
lazarus at lists.lazarus-ide.org>:
>> >
>> > Maybe, Sven could answer to this mail in the other thread...
>> >
>>
>> I provided an example in my answer to Tony Whyman in the same subbranch
of the thread.
>
>
> I suppose you mean this:
>>
>> In a tight loop where one accesss the string character by character
(take Pos() for example) this will lead to a significant slowdown as the
compiler (without optimizations) will have to insert a call to the lookup
function for each access. While I generally don't consider performance
degradation as a backwards compatibility issue I do in this case, due to
the significant decrease in performance.
>
> This is not applicable to the "DynamicString" discussed here. With that,
"pos" would just need to use the "bytes per element" value taken (once)
from the the String header, instead of a value supplied at compile time. I
don't think that this can introduce a considerable performance hit.

Yes it does, because without optimizations implemented and enabled the
compiler would need to do this for each element access.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170817/f8ea2f80/attachment.html>


More information about the Lazarus mailing list