From: Eleanor McHugh Date: 2008-06-28T20:39:04+09:00 Subject: Re: Big empty file creation On 28 Jun 2008, at 09:57, Zhukov Pavel wrote: > I need to creat an empty file, over 10GB size. > Which way is fastest in file creation? > > ------ > file<<"0"*file_size_in_bytes > ------- > consme too much memory > > ------- > for i in 1...x > file<"0"file_size/x > end > ------- > too slow :( Pick a value of x that's a multiple of 512 bytes as this will match your data writes to the OS's disk cache. This may or may not gain you some performance advantage which will vary depending on the underlying cluster size of the file system, general filesystem overhead, disk fragmentation and a host of other properties that our outside your control as a programmer. Even coding is assembler creating a 10GB file with each byte zeroed is going to be a slow process... Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason