4 ms·
There's also the question of using a SAX or DOM based parser. More than once, I've had to update a program using 32-bit perl from DOM (simple, fast) to SAX (sl
by hnick 6y ago
There's also the question of using a SAX or DOM based parser.
More than once, I've had to update a program using 32-bit perl from DOM (simple, fast) to SAX (slower but more control) as documents grew and the scripts crashed due to Out of Memory errors. Using SAX gave us event based handling to ignore certain nodes, or cache them to disk in another format as they got too big, and other fun stuff.
Rule of thumb was to multiply the document file size by 10 to get the memory footprint with a DOM approach, because of all the objects, relationships, and metadata that has to be stored for everything. One individual records got up above 100MB on disk we were in the danger zone.
Whereas JSON just loads into hashes and arrays and tends to not pose similar problems.