D:YAML 0.1

Kiith-Sa 42 at theanswer.com
Wed Aug 17 04:08:51 PDT 2011


Jacob Carlborg wrote:

> On 2011-08-16 21:12, Kiith-Sa wrote:
>> Jacob Carlborg wrote:
>>
>>> On 2011-08-16 20:13, Kiith-Sa wrote:
>>>> D:YAML is a YAML parser library for D.
>>>>
>>>> It is mostly compliant with the YAML 1.1 spec, although there are some
>>>> unsupported features (e.g. recursive data structures).
>>>>
>>>> Currently there is only a parser, not an emitter.
>>>>
>>>> The API is not yet stable, there will be breaking changes. (e.g. part
>>>> of the API depends on std.stream and will probably be changed when
>>>> std.stream is rewritten.)
>>>>
>>>> Docs can be found in doc/html in the package. There are some (very)
>>>> basic tutorials/examples and an API doc.
>>>>
>>>> Much of D:YAML code has been ported to D from PyYAML.
>>>>
>>>> D:YAML is written in D2. There is no D1 or Tango support, and none is
>>>> planned.
>>>>
>>>> Link: https://github.com/kiith-sa/D-YAML
>>>
>>> Interesting, I've been looking for a D YAML library for a while. How is
>>> the performance, have you made any benchmarks?
>>>
>>
>> Not yet. I intend to implement an emitter first and then start
>> benchmarking/profiling/optimizing. However, as much of the code is
>> directly translated from PyYAML (Python code, not the libYAML C
>> extension), I imagine it will be somewhat faster than that.
> 
> 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.



More information about the Digitalmars-d-announce mailing list