On Sun, Sep 30, 2012 at 6:44 PM, Brian Durand <[email protected]>wrote:
I opened a pull request on my changes: > https://github.com/rails/rails/pull/7800. > > I updated the code a bit and fixed the tests so it is slightly different > than the branch referenced above. It should now be backward compatible with > older cache entries as well. > Awesome, it is merged, thanks! > > As for the Array idea, that would certainly reduce overhead a little bit, > but I'm not sure it's worth it in terms of maintainability. For what it's > worth, 27 of the 58 byte serialization overhead comes just from the class > name "ActiveSupport::Cache::Entry". > Yeah, the idea would be not to use a class like that, well maybe in the Ruby side, but anyway serialize/deserialize an array. I have not tried to implement it, not sure I am not missing some blocker: 1.9.2p320 :007 > Marshal.dump([1, Time.now.to_i, false]) => "\x04\b[\bi\x06l+\a\xC0~hPF" 1.9.2p320 :008 > _.length => 14 It feels rigid though. Going with a hash is more flexible 1.9.2p320 :009 > Marshal.dump('v' => 1, 'x' => Time.now.to_i, 'c' => false) => "\x04\b{\bI\"\x06v\x06:\x06ETi\x06I\"\x06x\x06;\x00Tl+\a\xCB~hPI\"\x06c\x06;\x00TF" 1.9.2p320 :010 > _.length => 39 but then the benefit is maybe less clear. In any case, we have now a much efficient Entry class for Rails 4, and it understands existing entry objects. That's great! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
