This patch from 2011 (!) saves about 96% of the allocation cost (down from 500 MiB to 20 MiB) for check-qjson.
Paolo Paolo Bonzini (4): qjson: replace QString in JSONLexer with GString qjson: do not save/restore contexts qjson: store tokens in a GQueue qjson: surprise, allocating 6 QObjects per token is expensive include/qapi/qmp/json-lexer.h | 7 +- include/qapi/qmp/json-parser.h | 4 +- include/qapi/qmp/json-streamer.h | 16 +++- monitor.c | 2 +- qga/main.c | 2 +- qobject/json-lexer.c | 22 ++--- qobject/json-parser.c | 189 +++++++++++++++------------------------ qobject/json-streamer.c | 48 +++++----- qobject/qjson.c | 2 +- tests/libqtest.c | 2 +- 10 files changed, 125 insertions(+), 169 deletions(-) -- 2.5.0