Skip to content

json-parser: Support loading files via memory mapping

Philip Withnall requested to merge pwithnall/json-glib:memory-mapping into master

json_parser_load_from_file() is in the right position to be able to memory map the file it’s loading from: it reads the input once before building a JsonNode structure to represent it, doesn’t write to the file, and often deals with large input files.

Try memory mapping a file before falling back to loading it manually. This should speed things up slightly due to reducing time spent allocating a large chunk of heap memory to load the file into.

Signed-off-by: Philip Withnall

Merge request reports