libxml2 vs expat for an XMPP server

情到浓时终转凉″ 提交于 2019-12-12 08:03:13

问题


I'm trying to create an XMPP library (and later a server) from scratch in Go (although the language itself is irrelevant) as a means to learn what I can about the XMPP protocol and server software development in general.

As many of you know, XMPP is messaging protocol based on XML that depends on an enormous amount of short but frequent XML streams. I'm thinking that for such applications an event based XML parser should be better because I won't need DOM and all that (correct me if I'm wrong). Please keep in mind that this library is intended for servers so there might be many instances run at once;

Which one of the two has better performance and memory usage for that use case, libxml2 or expat?


回答1:


There is a whole project devoted to answering the question of XML performance called XML Benchmark.

The short answer, in my opinion, is to use libxml2, but I have other considerations beyond pure performance, such as platform availability. That said, it is generally faster than expat according to the latest numbers, though it's fairly close in the great scheme of things.

And yes, you want to use the SAX parser, not the DOM parser.



来源:https://stackoverflow.com/questions/3714184/libxml2-vs-expat-for-an-xmpp-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!