Bugs item #19772, was opened at 2008-04-25 08:40 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1971&aid=19772&group_id=494
Category: None Group: None >Status: Closed >Resolution: Rejected Priority: 3 Submitted By: Nobody (None) >Assigned to: Charlie Savage (cfis) Summary: Node#== incredibly slow! Initial Comment: When I replaced my REXML implementation of a time-critic routine with a Libxml implementation, the Libxml version took more than THREE TIMES LONGER than the REXML version! To investigate the reason, I reduced the implementation differences to a few core indivisibles and then ran ruby-prof, and discovered that Libxml was wasting huge amounts of time in Node#== 86.97% 0.46% 7.54 0.04 0.00 7.50 962 Opmllibxml#goleftone 7.49 7.48 0.00 0.01 962/962 XML::Node#== 0.01 0.01 0.00 0.00 962/962 XML::Node#parent My code says: def goleftone() parent = @curline.parent if parent == @top return false else @curline = parent return true end end (In other words, I already have a node called @top, of which @curline points to an element at some depth; I repoint @curline to point at its own parent, unless its own parent *is* @top.) I replaced my test, parent == @top, by a different test, using parent.name, and my routine went from 10.3 seconds to 2.2 seconds. Rather significant (though still not really very much faster than REXML). Unfortunately, this change caused me to get repeated error messages of the following form: ruby(1350) malloc: *** error for object 0x12cd520: incorrect checksum for freed object - object was probably modified after being freed, break at szone_error to debug ruby(1350) malloc: *** set a breakpoint in szone_error to debug However, I believe that this latter is something you may already know about. ---------------------------------------------------------------------- >Comment By: Charlie Savage (cfis) Date: 2008-07-07 01:08 Message: This is because libxml-ruby defines == to mean that two nodes have the same xml representation. What you are after is Ruby's equal? method, not the eql? method (which == uses). ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1971&aid=19772&group_id=494 _______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel