I have a large json file (~3.5 MB), with (~140) complex objects, and the max depth in the object graph is about 4-5. I use Gson to parse it, but it’s really slow. I’ve tried some way to parse it (like mixed parsing or using stream to parse), but I couldn’t increase performance.
I checked Memory Analizer, it kill memory (70-80%), if I only parse the base Id of the objects. While parsing there are 400-500k object in memory (mostly string and char).
Would be parsing more efficient if the object graph wouldn’t be so deep? Do you have a good idea how could be better? I tried other libs too (like Jackson), but performance wasn’t better.
I had some good performance boost by using Jackson – you should not load whole json into memory but use createJsonParser(Reader r). If it does not work for you then either try spliting data and use separate threads – it makes sense if CPU is not fully loaded by single threaded version. Otherwise try using JNI json parsing implementation.