From: Brian Candler Date: 2003-03-16T23:47:37+09:00 Subject: Re: Hash load and GC On Sun, Mar 16, 2003 at 02:33:55PM +0900, Xiangrong Fang wrote: > 1. Which is the best way to load a big hash from disk? I have searched > the talk archive, and I find that sysread seems the fastest. I also > tried to use Marshal.load, it seems slower. BTW, I'm using 1.6.7-mswin32 In my experience Marshal.load is blindingly fast. Just marshal the entire hash as one object, and read it back in thusly: dict = Marshal.load(File.open("/etc/en.dic.rm")) (Aside: is there a standard extension for 'ruby marshalled' objects??) You could compare speed with dict = Marshal.load(File.open("/etc/en.dic.rm").read) which may reduce calls to the Ruby IO library, at the expense of having to read the whole file into RAM at once. Regards, Brian.