Skip to content

feat: add scalable enrichment benchmark path - #41

Merged
clawosiris merged 2 commits into
mainfrom
issue-28-benchmark
May 16, 2026
Merged

clawosiris merged 2 commits into
mainfrom
issue-28-benchmark

Conversation

@clawosiris

Copy link
Copy Markdown
Owner

Summary

  • add a two-pass streaming Rust enrichment path for large file-based scan result inputs
  • pass rust-engine CLI jobs straight through from the Python wrapper so large outputs do not round-trip through Python memory
  • add synthetic fixture generation and a benchmark script for Python vs Rust enrichment comparison
  • document the large-input benchmark workflow and keep generated artifacts out of git

Benchmark

Using the generated 500k-result / 1000-IP VT-only fixture:

  • Python: ~20.21s
  • Rust: ~3.91s
  • Speedup: ~5.17x
  • Semantic output parity: verified

Also validated a 10k smoke benchmark path with ~5.32x Rust speedup.

Verification

  • uv run pytest
  • uv run ruff check .
  • cargo fmt --check
  • cargo test -p scan-enrichment
  • python3 scripts/benchmark_enrichment.py --results generated/synthetic-scan-results-500k.json --vt-metadata generated/synthetic-vt-metadata.json --runs 1 --warmups 0

Closes #28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a scalable, file-based Rust enrichment pipeline and updates the Python CLI wrapper to avoid loading large enriched payloads back into Python memory, plus scripts/docs to generate and benchmark large synthetic fixtures.

Changes:

  • Implement two-pass streaming enrichment output in the Rust CLI (OID/CVE collection pass + streaming enrich/write pass).
  • Update the Python openvas-enrich-results CLI to pass Rust engine runs directly through to the Rust binary for large outputs.
  • Add synthetic fixture generation + a benchmark harness, and document the workflow while ignoring generated artifacts.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rust/scan-enrichment/src/lib.rs Adds streaming JSON parsing/writing path (*_to_writer) and updates CLI to write without materializing the full enriched output.
src/scan_examples/enrichment.py Builds reusable Rust CLI command lines and adds a passthrough runner; CLI now uses passthrough when Rust is selected.
tests/test_enrichment_cli.py Adds parity coverage for wrapped {results: [...]} inputs and verifies CLI passthrough uses the Rust binary.
scripts/generate_synthetic_results.py Generates deterministic large synthetic scan-results + vt-metadata fixtures for scale testing.
scripts/benchmark_enrichment.py Benchmarks Python vs Rust enrichment and emits a JSON report including semantic parity checks.
README.md Documents the large-input benchmark workflow and the new streaming behavior.
.gitignore Ignores generated/ artifacts produced by the new scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Resolved
Comment thread scripts/benchmark_enrichment.py Resolved
Comment thread rust/scan-enrichment/src/lib.rs Resolved
@clawosiris
clawosiris merged commit ba59178 into main May 16, 2026
3 checks passed
@clawosiris
clawosiris deleted the issue-28-benchmark branch May 16, 2026 00:54
clawosiris added a commit that referenced this pull request May 16, 2026
## Summary
- add rustdoc comments across the `scan-enrichment` crate
- document the CLI arguments in `main.rs`
- add targeted inline comments around the trickier streaming and
metadata-merging code paths

## Notes
This is documentation-only follow-up work after #41. No behavior changes
intended.

## Verification
- `cargo fmt --all`
- `cargo test -p scan-enrichment`

Co-authored-by: OpenClaw Bot <clawd@tycho.cp.llnvd.lan>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create rust implementation of the scan result enrichment with library and cli

2 participants