Java - XML 解析器性能:Sun Java Streaming XML Parser (SJSXP) vs Wo

2023-01-14Java开发问题
9

本文介绍了Java - XML 解析器性能:Sun Java Streaming XML Parser (SJSXP) vs Woodstox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在寻找最新的、内存效率高的高性能 java XML 解析 API.我需要解析 3 MB 到 5 MB 的 XML 文件.

I am looking for latest, memory efficient and high-performance java XML parsing API. I need to parse 3 MB to 5 MB XML files.

我对此进行了谷歌搜索,了解到 Sun Java Streaming XML Parser (SJSXP) 和 Woodstox 比 DOM 快得多.萨克斯.两者都使用 StAX API.*这些技术不支持模式验证.

I did google on this and come to know about Sun Java Streaming XML Parser (SJSXP) and Woodstox is much faster than DOM & SAX. Both are using StAX API. *schema validation is not supported by these technologies.

Aalto XML 处理器也实现了 StAX API.

Aalto XML processor is also implements StAX API.

我还没有找到关于这些技术性能的具体发现.

I have not found concrete findings on performance on these technologies.

在内存效率、高性能和易用性方面哪一个是最好的?

Which one will be best in context of memory efficient, high-performance and ease of use ?

推荐答案

这里还有一些可能相关的链接:

Here are some more links that might be relevant:

  • 用于数据绑定的 Stax 实现:http://technotes.blogs.sapo.pt/1708.html
  • 高效使用 Woodstox:http://www.cowtowncoder.com/blog/archives/2006/06/entry_2.html
  • 使用 Woodstox 加速 XSLT:http://www.cowtowncoder.com/blog/archives/2009/04/entry_235.html

性能方面:SJSXP 最慢;它只是 Xerces 内部的重新包装,包装在 Stax API 中.这对性能有一些负面影响(因为它并不是真正为拉解析而设计的).伍德斯托克斯快一点;小文档和写作速度更快,解析较长文档时差异更小.

As to performance: SJSXP is the slowest; it's just a repackage internals of Xerces, wrapped in Stax API. This has some negative effects on performance (since it's not really designed for pull parsing). Woodstox is bit faster; much faster for small documents and writing, less difference when parsing longer documents.

到目前为止,Aalto 是三者中最快的,尤其是在解析方面.它通常比 Woodstox 或 SJSXP 快 50% - 100%.一个缺点是它不处理 DTD(因此不处理外部实体;它处理预定义和字符实体).

And Aalto is by far fastest of the three, especially for parsing. It is commonly 50% - 100% faster than either Woodstox or SJSXP. One downside is that it does not handle DTDs (and thereby not external entities; it handles pre-defined and character entities).

免责声明:我是 Woodstox 和 Aalto 的作者;以及 SJSXP 的贡献者(错误修复)

Disclaimer: I am author of Woodstox and Aalto; as well as contributor to SJSXP (bug fixes)

这篇关于Java - XML 解析器性能:Sun Java Streaming XML Parser (SJSXP) vs Woodstox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13