Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the trivial-mmap Reference Manual, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:41:55 2018 GMT+0.
• Introduction: | What trivial-mmap is all about | |
• Systems: | The systems documentation | |
• Files: | The files documentation | |
• Packages: | The packages documentation | |
• Definitions: | The symbols documentation | |
• Indexes: | Concepts, functions, variables and data types |
Trivial-MMAP is a Common Lisp library that aims to provide an easy-to-use API for working with memory-mapped files.
The library exports the following symbols:
mmap-file
a function that maps a file into memorymunmap-file
a function that removes a memory-mapped file from
memorymmap-read-char
a helper function that facilitates reading a
character from a memory-mapped filemmap-read-byte
a helper function for reading one byte from a
memory-mapped filewith-mmap-file
a helper macro that ensures that a memory-mapped
file is safely unmapped (using munmap-file
function) after we are
done with itTrivial-MMAP is based on code snippets in a blog post by Nicolas Martyanoff.
The following code snippet shows how to use Trivial-MMAP's
with-mmap-file
and mmap-read-char
to read one character at a time
from a file containing Twitter social graph (780 MB uncompressed).
CL-USER> (time
(trivial-mmap:with-mmap-file (ptr size "/home/zodmaner/twitter_rv_15066953.net")
(loop
:for offset :from 0 :to (1- size) :do
(characterp (trivial-mmap:mmap-read-char ptr offset)))))
Evaluation took:
3.400 seconds of real time
3.400000 seconds of total run time (3.360000 user, 0.040000 system)
100.00% CPU
8,479,536,815 processor cycles
65,952 bytes consed
The little toy benchmark above was run on my laptop (an i5 ThinkPad
X230 (Ivy Bridge) with 8 GB of RAM and an SSD). For comparison,
reading the same file using with-open-file
and read-char
takes
around 14 seconds of real time on the same machine.
Smith Dhumbumroong (zodmaner@gmail.com)
Public Domain
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The trivial-mmap system: |
Smith Dhumbumroong <zodmaner@gmail.com>
Public Domain
A library providing an easy-to-use API for working with memory-mapped files.
trivial-mmap.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files: |
• The trivial-mmap.asd file: | ||
• The trivial-mmap/package.lisp file: | ||
• The trivial-mmap/low-level-interface.lisp file: | ||
• The trivial-mmap/trivial-mmap.lisp file: |
Next: The trivial-mmap/package<dot>lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
trivial-mmap.asd
trivial-mmap (system)
Next: The trivial-mmap/low-level-interface<dot>lisp file, Previous: The trivial-mmap<dot>asd file, Up: Lisp files [Contents][Index]
trivial-mmap (system)
package.lisp
Next: The trivial-mmap/trivial-mmap<dot>lisp file, Previous: The trivial-mmap/package<dot>lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
trivial-mmap (system)
low-level-interface.lisp
Previous: The trivial-mmap/low-level-interface<dot>lisp file, Up: Lisp files [Contents][Index]
low-level-interface.lisp (file)
trivial-mmap (system)
trivial-mmap.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The trivial-mmap package: |
package.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions: | ||
• Internal definitions: |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros: | ||
• Exported functions: |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
trivial-mmap.lisp (file)
Previous: Exported macros, Up: Exported definitions [Contents][Index]
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal macros: | ||
• Internal functions: | ||
• Internal structures: |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Uses MMAP-FILE to maps a FILENAME into memory.
POINTER-TO-MMAP-FILE and FILE-SIZE are bound to values that MMAP-FILE returns after we apply it to FILENAME.
low-level-interface.lisp (file)
Next: Internal structures, Previous: Internal macros, Up: Internal definitions [Contents][Index]
Maps a FILENAME into memory.
low-level-interface.lisp (file)
Reads and returns one byte from a memory-mapped file pointed to by the POINTER-TO-MMAP-FILE pointer, offset by OFFSET bytes.
low-level-interface.lisp (file)
Reads and returns a character from a memory-mapped file pointed to by the POINTER-TO-MMAP-FILE pointer, offset by OFFSET bytes.
low-level-interface.lisp (file)
Removes a mapping at the address (with the range of FILE-SIZE) that the POINTER-TO-MMAP-FILE pointer points to from memory.
low-level-interface.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
trivial-mmap.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
trivial-mmap.lisp (file)
structure-object (structure)
(cffi-sys:null-pointer)
mmapped-file-pointer (function)
(setf mmapped-file-pointer) (function)
fixnum
0
mmapped-file-size (function)
(setf mmapped-file-size) (function)
fixnum
0
mmapped-file-offset (function)
(setf mmapped-file-offset) (function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index: | ||
• Function index: | ||
• Variable index: | ||
• Data type index: |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L T |
---|
Jump to: | F L T |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
(
C F M W |
---|
Jump to: | %
(
C F M W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | O P S |
---|
Jump to: | O P S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | M P S T |
---|
Jump to: | M P S T |
---|