Fastest JSON parser in the world is a D project

Marco Leise via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Oct 16 09:26:23 PDT 2015


Am Fri, 16 Oct 2015 11:09:37 +0000
schrieb Per Nordlöw <per.nordlow at gmail.com>:

> On Wednesday, 14 October 2015 at 07:01:49 UTC, Marco Leise wrote:
> > https://github.com/kostya/benchmarks#json
> 
> Does fast.json use any non-standard memory allocation patterns or 
> plain simple GC-usage?

Plain GC.  I found no way in D to express something as
"borrowed", but the GC removes the ownership question from the
picture. That said the only thing that I allocate in this
benchmark is the dynamic array of coordinates (1_000_000 * 3 *
double.sizeof), which can be replaced by lazily iterating over
the array to remove all allocations.

Using these lazy techniques for objects too and
calling .borrow() instead of .read!string() (which .idups)
should allow GC free usage. (Well, except for the one in
parseJSON, where I append 16 zero bytes to the JSON string to
make it SSE safe.)

-- 
Marco



More information about the Digitalmars-d-announce mailing list