schoppenhauer wrote:reading into a sequence needs a lot of memory. using mmap is faster and normally simpler, otherwise one would have to implement random access. I wonder why mmapped files accessible via normal sequence ops are not already a common extension to cl. I mean its something obvious and should be easy to implement, and most platforms do have something similar to mmap, for the others one can simply write a wrapper for random access.
It should be up to the implementation to abstract low level optimizations away. I think some implementations like SBCL already have file access not much slower than mmap, or possibly even using it. Are you actually having trouble with speed in file access or are you just previously worried? If your case is the latter, make your program and worry about that later, otherwise, at least do some benchmark before concluding you are actually having some performance gain by using mmap instead of using CL's functions.
Then, if you really need to, you should try to implement file reading in C, compile it to a dynamic library and wrap it with CFFI, as suggested by Ramarren. And, like he said, you can even pass a Lisp array as a pointer and manipulate it in C. If you don't mind using vectors of '(unsigned-byte 8), there are portable functions available in CFFI that
allow you to do that.