Am 22.08.2014 20:08, schrieb Walter Bright:
(...)
2. The escape sequenced strings presumably consume GC memory. This will
be a problem for high performance code. I suggest either leaving them
undecoded in the token stream, and letting higher level code decide what
to do about them, or provide a hook that the user can override with his
own allocation scheme.

If we don't make it possible to use std.json without invoking the GC, I
believe the module will fail in the long term.

I've added two new types now to abstract away how strings and numbers are represented in memory. For string literals this means that for input types "string" and "immutable(ubyte)[]" they will always be stored as slices to the input buffer. JSONValue has a .rawValue property to access them, as well as an "alias this"ed .value property that transparently unescapes.

At that place it would also be easy to provide a method that takes an arbitrary output range to unescape without allocations.

Documentation and code are both updated (also added a note about exception behavior).

Reply via email to