On Monday 09 November 2009 06:54:15 am apeiros / gmx.net wrote: > Hi Joel > > > What would the advantage over mmap[1] be? FileString is pure ruby > > (right?) and hence more portable, but probably mmap is much more > > efficient? Any other tradeoffs? > > Interesting, I was looking if a solution existed already and didn't find > mmap. Yes, FileString is pure ruby and should therefore run on all ruby > implementations. And yes, I'd expect mmap to be more efficient on the other > hand. I'd have looked for mmap first, knowing the concept from Linux. I'd also expect that with mmap, you should be able to implement an efficient regex, though I'm not sure how well gsub! would work, unless you can guarantee the match is always exactly the length of the target string. (And for gsub to be efficient, you'd need some fancy copy-on-write stuff, which would make it that much more difficult to chain them.) But if you were looking for comments, it looks awesome. Thanks!