Google Groups Home
Help | Sign in
对Java处理XML性能的比较(DOM和SAX)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
tiny  
View profile
 More options Dec 22 2007, 12:01 pm
From: tiny <tinyf...@gmail.com>
Date: Sat, 22 Dec 2007 09:01:32 -0800 (PST)
Local: Sat, Dec 22 2007 12:01 pm
Subject: [Tinyfool的开发日记(blog)] 对Java处理XML性能的比较(DOM和SAX)

测试数据是结构很简单的一个20M的XML文档,里面的数据来自我的一个项目。测试
程序很简单,就是读取这个XML文件,把里面的链接写入到一个文本文件。然后把
数据原样重复了一遍,然后又测试了一次,下面是测试结果。方法数据大小内存峰
值CPU峰值耗时SAX 20M 20M 30% 142秒 DOM 20M 152M 100% 171秒 SAX 40M 20M
30% 290秒 DOM 40M 345M100%376秒表1 SAX和DOM的性能比较结论:SAX的内存消耗
稳定,CPU占用率低,耗时短,大数据量XML的简单处理一定首选SAX。DOM的性能受
到内存的严重影响,内存消耗受到数据量的影响,大数据量XML的读处理最好不要
用DOM。

--
由 tiny 于 12/22/2007 06:30:00 下午 在 Tinyfool的开发日记(blog) 上发表


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google