How large must be a file to prevent you use DOM or SimpleXML and use a pull parser instead?
I am going to build a script and I will handle a really big XML file. My question is when you have to move to a pull parser instead of using DOM or SimpleXML?
When the开发者_开发技巧 xml file is loaded into memory, it will be loaded every time for each user that requests data from it, even simultaneously or a single time for a period ?
Should I follow the "chunk method" or to avoid it and use SAX/XMLreader ?
Thank you.
Tree-based representations of XML, such as DOM, generally use 5-to-10 times the source document size. So it becomes a pain above 200Mb or so (or less if you're trying to handle a high concurrency and throughput, of course).
If you want to avoid repeatedly loading the same document into memory, your application should maintain a cache.
精彩评论