A high-performance Common Lisp library for fast octet-vector and octet-stream I/O operations.
fast-io is a Common Lisp library designed to significantly improve the performance of octet-vector and octet-stream input/output operations. It provides a straightforward interface for reading and writing bytes and sequences, with a focus on reducing consing and execution time compared to standard approaches like vector-push-extend and flexi-streams.
Common Lisp developers working on performance-critical applications that involve extensive octet-level I/O, such as network programming, binary data processing, or foreign function interface (FFI) interactions.
Developers choose fast-io for its substantial performance gains in speed and reduced memory allocation, its support for multi-byte endian operations, and its integration with static-vectors for efficient FFI usage without extra copying.
Fast octet-vector/stream I/O for Common Lisp
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show fast-io writes 50-byte vectors 8.5x faster than vector-push-extend and 28x faster than flexi-streams, with execution time dropping from 0.767s to 0.090s.
Reduces bytes consed by over 80% compared to standard methods, from 104.8M to 18.4M in benchmarks, minimizing garbage collection overhead.
Provides a comprehensive set of functions like write32-be and readu16-le for reading/writing 8- to 128-bit values in both big- and little-endian formats.
Supports output to static-vectors via :static option, enabling direct pointer passing to foreign functions without extra copying, as highlighted in the README.
The gray-streams wrapper is 3-4x slower than using buffers directly, with benchmarks showing 1.7s vs 0.8s for writing 1M vectors, limiting its utility for stream-heavy code.
Static-vectors require explicit freeing with static-vectors:free-static-vector, adding complexity and potential for memory leaks if not handled correctly.
Focused solely on raw octet operations; lacks built-in support for serialization formats or error handling beyond basic EOF checks, requiring additional layers for complex data.