From: Aaron Patterson Date: 2008-11-02T02:50:39+09:00 Subject: Re: XML builder performance On Fri, Oct 31, 2008 at 10:01:14PM +0900, Xin Zheng wrote: > Hi all, > > I have been doing some performance testing, and have noticed it takes > significantly longer to render a XML output then a HTML one. It made me > think perhaps there's a faster way of generating XML than using XML > builder. > > I did a quick search and did not find any alternatives, or anyone > talking about XML builder's performance issues. > > Is there anyway of optimizing XML Builder? Or is there a faster > alternative? How large are the documents you're trying to build? If they are small, I recommend faster-builder: http://github.com/codahale/faster-builder/tree/master Unfortunately its speed diminshes a lot as the number of nodes increase. If the documents are large, you should try Nokogiri's builder. I found it to be faster for larger documents than faster-builder. Here is my benchmark: http://gist.github.com/14196 Here is some example builder code: http://github.com/tenderlove/nokogiri/wikis/generate -- Aaron Patterson http://tenderlovemaking.com/