From: Dave Thomas Date: 2001-08-18T14:03:10+09:00 Subject: [ruby-talk:19966] Re: Slow file I/O? (newbie) Bil Kleb writes: > So we were trying to test the speed of mirrored versus non-mirrored > disks and decided to use Ruby to do the testing. We wrote a couple > one-liners to write and read a Gigabyte-sized file of all 1's, viz, > > File.open("testFile","w") { |f| (2**30).times{f.putc "1"} } Well, with the best will in the world, Ruby is going to be way, way slower than C here, if for no other reason than the number of instructions executed. However, your test isn't simply measuring the speed of writing to disks. In both C and Ruby, that putc is going to be buffered in the underlying library before being written to disk in chunks of a block. You might want to find the underlying blocksize using File.stat().blksize, and then use IO#write to write stuff out in chunks that big. Regards Dave