On 2011-08-17 13:08, Kiith-Sa wrote:
Jacob Carlborg wrote:
Does the parser/lexer take advantage of D's slices to make it faster?


In some places, yes, in some places, no. I didn't concentrate on preventing
new strings from being allocated, but a lot of string data should pass
through the code unchanged, with just slices changing. Phobos functions
should help with that (E.g: afaik when you split() a string, you just get
slices to the same string data?). Still, the parser, scanner (and composer)
are precisely the parts of code that were ported from PyYAML, and the code
is mostly similar to PyYAML.

Ok, I see. It should be possible to create a parser that doesn't allocate memory, only uses slicing. A great example of that is the XML module in Tango.

--
/Jacob Carlborg

Reply via email to