rti/FastXml

Does this code work in rails 3?

Opened this issue · 7 comments

Does this code work in rails 3?
rti commented

I never tested it. Sorry. But it might be worth a try since the principle is quite simple.

I see what you mean. It looks like, however, that there is a lot of
duplication of the general to_xml logic from AR 2.3.x.

Just off the top of my head, it looks like we'd have to 'rebase' your
modifications off of the 3.0.x code, right? In other words, we'd want
to start with the current state of those methods, and merge in the
LibXML::XML::Node stuff in the appropriate places, right?

Please let me know if I am not understanding correctly how this works.

-Marc

On Sat, Jun 4, 2011 at 3:52 AM, rti
reply@reply.github.com
wrote:

I never tested it. Sorry. But it might be worth a try since the principle is quite simple.

Reply to this email directly or view it on GitHub:
#1 (comment)

rti commented

Correct. That's the basic idea.
Yes. Maybe rebasing it might be the better option. This would work exactly as you described it.

Would be really great if you plan to share this code as well :)

I'd like to do this, but I'm not committing to it until I get a look
at how these things are done now.

Based on what I see here in ActiveRecord 3.0.7:
https://github.com/rails/rails/blob/v3.0.7/activerecord/lib/active_record/serializers/xml_serializer.rb

There's clearly a lot more moving parts now, and it looks as though
the code is already using the XmlMini backend to generate tags. I
think that at least some of this functionality is now built into
rails.

It appears that you must configure your XmlMini backend as follows
(http://api.rubyonrails.org/classes/ActiveSupport/XmlMini.html):

ActiveSupport::XmlMini.backend = 'LibXML'

-Marc

On Sat, Jun 4, 2011 at 12:28 PM, rti
reply@reply.github.com
wrote:

Correct. That's the basic idea.
Yes. Maybe rebasing it might be the better option. This would work exactly as you described it.

Would be really great if you plan to share this code as well :)

Reply to this email directly or view it on GitHub:
#1 (comment)

Marc Siegel
Technology Specialist
American Technology Innovations

Email: marc@usainnov.com
Phone: 617-399-8145
Cell: 617-223-1220
Fax: 267-219-0735

rti commented

So that is interesting. Being able to configure the XML backend makes FastXML indeed pointless for RoR 3.x.

Right, except that I haven't been able to see any speed improvement in
my own benchmarks when I switch out the XmlMini back end.

I posted a question to StackOverflow, and answered it with what I
could discover, here:
http://stackoverflow.com/questions/5891507/does-rti-fastxml-or-anything-like-it-work-with-rails-3-to-speed-up-xml-renderin

From what I could determine, the only thing that had a substantial
effect was using the gem 'fast_xs', which makes part of the encoding
process faster. The XmlMini backends (both LibXML and Nokogiri, which
both use libxml2) seemed to have no effect.

Do you have any thoughts on this?

-Marc

On Sat, Jun 4, 2011 at 1:23 PM, rti
reply@reply.github.com
wrote:

So that is interesting. Being able to configure the XML backend makes FastXML indeed pointless for RoR 3.x.

Reply to this email directly or view it on GitHub:
#1 (comment)

rti commented

Oh ok, thats indeed disappointing.
No sorry. No idea. Might need some detailed profiling to find out whats consuming the cpu time here.