[Gambas-user] Is the &= efficient?
Cedron Dawg
cedron at exede.net
Tue Mar 5 22:03:45 CET 2019
A little thinking helps. I'm going with alloc/memory/free, because I have an idea how much space I will need.
Having +=, -=, *=, etc is a huge plus for me compared to other BASICs.
Open question (also asked at forum.gambas.one) to all.
Do you prefer
Inc x
Dec x
or
x += 1
x -= 1
?
----- Original Message -----
From: "Benoît Minisini" <g4mba5 at gmail.com>
&= is just syntactic sugar. A &= B is the same thing as A = A & B, and
so using &= for adding a string to a buffer does a lot of useless
allocations.
Two workarounds:
1) Using a second string as an intermediate buffer.
2) Using OPEN STRING instruction. It implements a string buffer, and so
does less allocations.
Regards,
--
Benoît Minisini
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
More information about the User
mailing list