From: Jim Freeze Date: 2003-04-17T19:45:58+09:00 Subject: Re: Need IO Optimization help On Thursday, 17 April 2003 at 19:29:16 +0900, David King Landrith wrote: > In my experience, the fastest way to access files (by far) is mmap. > I've written some C extensions to Ruby that use mmap to read files, and > they is dramatically faster the versions that I wrote using standard, > buffered IO. All of the stuff I have written is for a specific purpose > (e.g., a state machine to read character delimited files). Is there > any generic Ruby Extension that gives provides access within ruby to > mmap? > > Following is some code that copied out of I out of one of my C > extensions to give you a quick idea of what it takes to read using mmap: > [mmap stuff deleted] Thanks much. I'll look into this. I have already gone from a 18% loss to a 15.5% lead over perl by switching to rb_io_gets. Do you think that mmap will get me speeds near cp? -- Jim Freeze ---------- A sine curve goes off to infinity or at least the end of the blackboard -- Prof. Steiner