From: Steven Lumos Date: 2003-12-12T05:17:00+09:00 Subject: Re: [Q] Fast loading of BIG data structures "T. Onoma" writes: > On Thursday 11 December 2003 02:27 am, Steven Lumos wrote: > > My question is: Is there an even faster way to load a big structure > > than this? > > > > My first thought was to use Marshal, but I was surprised to find that > > Marshal.load takes about twice as long as require: > > > > $ ruby -v > > ruby 1.8.0 (2003-08-04) [sparc-solaris2.8] > > $ time ruby -e "require 'network'" > > real 0m3.431s > > user 0m3.080s > > sys 0m0.200s > > $ time ruby -e "File.open('network.dump') {|f| Marshal.load(f)}" > > real 0m7.321s > > user 0m6.880s > > sys 0m0.170s > > Curious. What kind of machine are you running this on? These times seem a bit > slow in general. That was on a Blade 2000, but the timing for the require case is basically the same on an Athlon 1600 running Windows 2000. > I'm also wondering how Yaml would compare. Are you running ruby 1.8+? If so > try using to_yaml and dumping the result to a file, and then reload. Simple > example to help if you're not familiar with Yaml: I love Yaml, but I didn't try it because it's already documented as being slower than Marshal. Steve