If you use memfiles then you can just map the whole file and let the OS page 
things in from disk on demand as necessary. This gives you a "whole file buffer 
for almost free" kind of user interface. After the first run or file 
creation/etc. there may be zero/little IO and also very little copying of data 
from kernel space to user space. You do need a real file name that is seekable 
(i.e. "stdin" may not work), but if that constraint is ok for you then mapped 
files is almost always the fastest way to go and among the easiest to use, too. 
You can look at the memSlices iterator in memfiles.nim for one example.

Reply via email to