Changelog¶
All notable changes to log-surgeon-ffi are documented in this file.
The format follows Keep a Changelog.
[0.1.0-beta.10]¶
Added¶
- Rust backend. C++ remains the default; Rust backend is available via
Parser(backend="rust")or theLOG_SURGEON_BACKEND=rustenvironment variable. Theliblog_mechanicshared library is compiled during the wheel build and installed inside thelog_surgeon/package directory, so no manual build orLOG_MECHANIC_LIB_PATHis required. cffiis now a required dependency (previously optional under[rust]extra). Rust backend is available out of the box.RustBackendcontext manager. Resources are released automatically when usingwithstatement.- Build: Rust in wheels.
taskfiles/deps.yamladdslog-mechanicandlog-mechanic-buildtasks (download Rust source, install toolchain via rustup if needed, build with platform-aware logic: Linux glibc/musl, macOS universal2).CMakeLists.txtinstalls the built.so/.dylibinto the package directory. CI installs Rust toolchain on macOS runners and in Linux containers. "Programming Language :: Rust"classifier inpyproject.toml.- Backend performance tests (
tests/test_backend_performance.py). Compare C++ vs Rust throughput:parse_event(duration-based) andparsestream (fixed iterations). Optional RSS monitoring to stop early if memory grows. Correctness checks ensure both backends produce equivalent results. - Documentation: why C++ is faster in benchmarks. README and Architecture doc describe the top two reasons: (1) C++ does full parse and event assembly in native code and returns one event per call; Rust exposes a fragment-level lexer and event assembly is done in Python. (2) Rust incurs more FFI round-trips per event than C++ (one call per event).
Changed¶
- Rust backend: streaming parse.
RustBackend.parse()now streams one fragment at a time instead of collecting all fragments for the entire input before yielding events. Memory usage is O(current event) instead of O(entire input), so long-running or repeated parsing no longer grows unbounded. pyproject.toml:before-buildreplaced withbefore-all. C++ and Rust dependencies build once per platform container instead of once per Python version._rust_ffi.py: library discovery. Search order is (1)LOG_MECHANIC_LIB_PATHenv var, (2) package directory (bundled in wheel), (3) project layout fallbacks for development.
Removed¶
[project.optional-dependencies] rustextra.cffiis now a required dependency;pip install log-surgeon-ffi[rust]is no longer needed.