On 01/07/2010 02:32 PM, Florian Odronitz wrote: > Thank you for your very informative answers. You're welcome! > I was missing the thing with the binary mode. In the real use case I am > writing to and reading from Memcache. > > I tried to serialize the data with YAML and JSON which turned out to be > far too slow. > > I followed your suggestion and am now converting dates to strings and > parsing them at the receiving end which works fine. If performance is crucial you should probably check parsing performance. I remember I did the parsing myself once because #strptime was too slow. Ah, found it: http://github.com/rklemme/muppet-laboratories/blob/master/bin/sample-animal.rb If you can better use a numeric type like Time#to_i or Time#to_f. It may be that you can get at the rational inside Date. irb(main):001:0> d=Date.today => #<Date: 2010-01-07 (4910407/2,0,2299161)> irb(main):002:0> d.instance_variables => [:@sg, :@of, :@ajd, :@__ca__] irb(main):003:0> d.instance_variables.map {|iv| d.instance_variable_get(iv)} => [2299161, 0, (4910407/2), {252120=>2455204, 258504=>[2010, 1, 7]}] Then you "only" need to transform that back into a Date. :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/