duancuan7057 2011-07-21 10:38
浏览 88
已采纳

一个文件有多大以防止你使用DOM或SimpleXML并使用拉解析器?

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.

  • 写回答

1条回答 默认 最新

  • doufuxing8691 2011-07-21 11:31
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏