From: Robert Klemme Date: 2008-04-01T15:48:00+09:00 Subject: Re: rexml to slow 2008/3/31, Bu Mihai : > Robert Klemme wrote: > > 2008/3/31, Marc Heiler : > >> I believe the core problem is that XML itself is pretty sub-optimal for > >> almost everything ;) > > > > As always, there are problems where this tool (XML) is suited good, > > less good and not at all. > > > >> Is anyone updating the REXML website by the way? I believe it would be > >> interesting to see exactly these kind of speed issues handled on the > >> website because if i am not mistaken, these questions and problems > >> continually pop-up with *XML > > > > Not sure whether I agree: IMHO in this case the problem is a > > misapplication of XML. XML is good for persisting structured data but > > not as an in memory model for calculations. > > What is IMHO? http://www.google.com/search?q=imho http://dictionary.reference.com/search?q=imho >; i'm a newbie in ruby and at first i was searching > something similary with C++ tree structure (beacause that i would use if > is was C) but i want in ruby and i was searching some gem to help me > because i have to learn more about ruby language to build my own ruby > class to work with. I believe it works better the other way round: understand a concept (such as "tree", which is not too difficult) and implement it in Ruby. http://raa.ruby-lang.org/search.rhtml?search=tree Apart from that, it's easy to roll your own: TreeNode = Struct.new :data, :parent, :children do def initialize(data = nil, parent = nil) self.data = data self.parent = parent self.children = [] end end > I've tried xml beacuse it was the best (!?) i found in ruby for > implementing a tree structure (not only a binary tree), but it is slowly > when i want to read a big structure. 900 lines XML is far from a "big structure". And XML is format for /persistently/ storing structured data - mostly in files. An XML DOM is nothing you want to do complex non XML operations on. because of the overhead. Kind regards robert -- use.inject do |as, often| as.you_can - without end