[Gambas-user] Make String class friendlier
Benoît Minisini
g4mba5 at gmail.com
Wed Apr 7 17:24:43 CEST 2021
Le 07/04/2021 à 17:11, Martin a écrit :
> ok, I do not know the scope that something like this can have in the
> performance of the interpreter, but I leave an example of an independent
> class that works in the way I say except that it must be defined as "AS
> New"
>
> in some form...
>
String being not objects allows many performance optimizations on memory
allocations.
For example:
* Left(), Mid(), Right(), Trim() do not allocate memory.
* A &= B does not use an intermediate allocation most of the time.
* Strings have their own allocator, so that the glic memory allocator is
avoided most of the time.
This make string management in Gambas fast, often faster than many other
languages (see the benchmarks on the wiki).
Making String use an object syntax without performance penalty would
need a big support of the compiler instead of interpreter support, so
that the object syntax is rewritten into the old one before being
compiled. It won't be done now!
Regards,
--
Benoît Minisini
More information about the User
mailing list