Speeding up Active Resource

Posted by Bart ten Brinke Thu, 19 Jul 2007 08:20:47 GMT

As I was trying to import 12 MB of XML, it quickly became very clear that the SimpleXML used in Hash.from_xml was not going to cut it. It took nearly four minutes to convert the xml data to a hash!

As Active Resource will probably be used to handle large xml files, I created a patch so that libxml is used to parse the xml. This made fetching the active resource go from 240 seconds to 12 seconds. That 20 times faster!

The net override (also included) makes downloading a factor four faster.

Find the patch here: http://dev.rubyonrails.org/ticket/9017

Posted in  | Tags , , , , ,  | no comments