Empact / roxml

ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshalling between Ruby and XML using annotation-style class methods, via Nokogiri or LibXML.
http://roxml.rubyforge.org/
MIT License
223 stars 176 forks source link

Don't rely on ActiveSupport, for Merb and others' sake #8

Closed Empact closed 15 years ago

Empact commented 15 years ago

Ideally, we'd carry our own extensions with us, or not extend at all.

Reported by gconaty:

Any way you can not include all of active support? I'm using ROXML with Merb and the active support JSON being included by ROXML is breaking my app :) Having the gem worked before because you were just requiring specific modules.

I know you can turn off Merb's use of the JSON gem, but it actually produces valid JSON in some cases where ActiveSupport is breaking down.

konung commented 15 years ago

Hmm, merb and rails are mering soon. My guess will see something by the end of the year, we'll know if rails will be more agnostic like merb or not. why not wait till it's clear before rewriting ?

justfalter commented 15 years ago

I'd vote for pulling ActiveSupport out if only because of its memory usage. It seems to use of ~11.5 megabytes of RAM just by itself. The 'memory_usage' deal that I run here returns the number of kilobytes that the current process (in this case, IRB) is using in memory.

irb(main):001:0> memory_usage = `ps -o rss= -p #{Process.pid}`.to_i
=> 4760
irb(main):002:0> require 'roxml'
=> true
irb(main):003:0> memory_usage = `ps -o rss= -p #{Process.pid}`.to_i
=> 16636

To demonstrate where the impact is, I do a require of 'active_support' and then 'roxml' :

irb(main):001:0> memory_usage = `ps -o rss= -p #{Process.pid}`.to_i
=> 4760
irb(main):002:0> require 'activesupport'
=> true
irb(main):003:0> memory_usage = `ps -o rss= -p #{Process.pid}`.to_i
=> 16104
irb(main):004:0> require 'roxml'
=> []
irb(main):005:0> memory_usage = `ps -o rss= -p #{Process.pid}`.to_i
=> 16748

I haven't dug too far into how ROXML really uses ActiveSupport, but I have to wonder if it is really worth nearly quadrupling the memory usage.

Empact commented 15 years ago

I'm leaving activesupport in on account of the Rails 3 work toward selective inclusion (thus addressing memory and pollution concerns) and Yehuda's assurances that it will then be a reliable base library.