[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JSON/YAML/TOML/etc. parsing performance

From: Philipp Stephani
Subject: Re: JSON/YAML/TOML/etc. parsing performance
Date: Sun, 29 Oct 2017 22:49:56 +0000

Philipp Stephani <address@hidden> schrieb am So., 29. Okt. 2017 um 21:48 Uhr:
Paul Eggert <address@hidden> schrieb am Mo., 9. Okt. 2017 um 08:19 Uhr:
Philipp Stephani wrote:
> I don't think Jansson can use xmalloc because xmalloc can exit nonlocally,
> which is not expected by a third-party library such as Jansson. It could
> use a suitable wrapper of lmalloc, though.

That would be overkill, as lmalloc arranges for Lisp alignment, which Jansson
does not need. We could define new functions (smalloc and srealloc, say), that
act like malloc and realloc except they return NULL for requests larger than
PTRDIFF_MAX. Right now, I expect only the JSON code needs this sort of thing so
we could put the new functions in json.c. If other code needs it later we could
move these new functions to alloc.c.

Yes, that sounds reasonable. 

Here's a new patch that incorporates some of these changes. Specifically:

- I've removed some of the assertions
- I've installed a custom allocator, as you suggested
- Reverted back to creating a temporary string and inserting that into the buffer. Anything else just doesn't seem to work or seems way too complex.
- Introduced explicit encoding and decoding. I suspect that will lead to a massive performance hit, but I haven't done any benchmarks yet.
- Added manual section and NEWS entry 

Attachment: 0001-Implement-native-JSON-support-using-Jansson.txt
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]