On 12/02/2011 07:02 PM, Somedude wrote:
Le 01/12/2011 12:26, Regan Heath a écrit :
On Wed, 30 Nov 2011 22:04:13 -0000, Timon Gehr<timon.g...@gmx.ch> wrote:
The quite common claim that you cannot use Phobos without cluttering
up all your code with allocations is just not true. Phobos is not an
Object-oriented class library. There are seldom hidden allocations,
and it is almost always obvious when allocations must happen. The most
useful high-level features of D are compile time features that do not
harm performance (on the contrary).
But, it is true you cannot use the ~ operator on strings without
involving the GC, right?
Maybe this isn't a problem for people who want to manually manage memory
for performance reasons but it is right at the very lowest levels of
"what is D" and it seems like something where it should be possible to
choose how the memory for a string is allocated etc.
R
OTOH, string concatenation is not the most critical thing for game
writers, is it ?
I would see it more likely in XML parsing libraries, but D is already
the fastest performer in this area (but maybe it could be faster without
GC ?).
I would claim that it is fast there mainly because of the combination of
humble dependence on GC and array slicing. Array slicing is a lot less
powerful without any GC support. (of course, the particular way the
parser is implemented matters a huge lot. The soon-to-be replaced
std.xml module does not hold a candle to Tango's XML parsers,
performance-wise.)