From: Darrin Thompson Date: 2001-11-03T01:55:47+09:00 Subject: [ruby-talk:24179] Re: Performance of Marshal.dump Apologies for the length of this. Could I get out of that "assignment" if instead I provide a simple program that duplicates the problem for me? Try this. I'm using 1.6.4 right now. class MyData attr_accessor (:a, :b, :c, :d, :e) def initialize(a, b, c, d, e) @a=a @b=b @c=c @d=d @e=e end end array=Array.new (1..6000).each { | i | array.push( MyData.new(i, "zippy", "foo", "bar", "x")) } value=Marshal.dump(array) Here is the output from the line profiler (snipped): =========== problem.rb Line time% time count 1 0% 0.00 1 class MyData 2 0% 0.00 1 attr_accessor (:a, :b, :c, :d, :e) 3 0% 0.00 1 def initialize(a, b, c, d, e) 4 1% 0.82 6000 @a=a 5 0% 0.69 6000 @b=b 6 1% 0.81 6000 @c=c 7 1% 0.81 6000 @d=d 8 1% 1.95 6000 @e=e 9 end 10 end 11 12 13 0% 0.00 1 array=Array.new 14 15 0% 0.00 2 (1..6000).each { | i | 16 1% 1.81 6000 array.push( MyData.new(i, "zippy", "foo", "bar", "x")) 17 } 18 19 93% 137.74 1 value=Marshal.dump(array) Darrin ts wrote: >>>>>>"D" == Darrin Thompson writes: >>>>>> > >D> value=Marshal.dump array > > Can you try it with 1.7.1 and see if you have a difference ? > > >Guy Decoux >