std.xml and Adam D Ruppe's dom module

Jonathan M Davis jmdavisProg at gmx.com
Wed Feb 8 00:29:55 PST 2012


On Wednesday, February 08, 2012 09:12:57 Johannes Pfau wrote:
> Using ranges of dchar directly can be horribly inefficient in some
> cases, you'll need at least some kind off buffered dchar range. Some
> std.json replacement code tried to use only dchar ranges and had to
> reassemble strings character by character using Appender. That sucks
> especially if you're only interested in a small part of the data and
> don't care about the rest.
> So for pull/sax parsers: Use buffering, return strings(better:
> w/d/char[]) as slices to that buffer. If the user needs to keep a
> string, he can still copy it. (String decoding should also be done
> on-demand only).

That's why you accept ranges of dchar but specialize the code for strings. 
Then you can use any dchar range with it that you want but can get the extra 
efficiency of using strings if you want to do that.

- Jonathan M Davis


More information about the Digitalmars-d mailing list