std.xml should just go
Michel Fortin
michel.fortin at michelf.com
Fri Feb 11 06:45:31 PST 2011
On 2011-02-11 09:29:03 -0500, Bruno Medeiros
<brunodomedeiros+spam at com.gmail> said:
> On 11/02/2011 13:48, Steven Schveighoffer wrote:
>> I think D can do it without copying out of the buffer. You just have to
>> avoid using immutable strings.
>>
>> -Steve
>
> The data that you want to keep afterwards you will have to copy, that
> much is obvious.
In fact, if the amount of data you want to keep is greater than the one
you want to throw away, it might be better to make the buffer immutable
and allocate new buffers as you go forward. One allocation per buffer
is likely going to be less wasteful than one allocation + one copy per
string (+ some space wasted after each memory block).
If you don't intend to keep most of the data after parsing however,
then you should go for a mutable buffer and copy what you need.
What I like very much about Andrei's proposal for a buffered input
range is that it makes it supports equally well mutable and immutable
buffers.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list