Skip to content

Optimize parsing, filtering, and rendering performance#27

Merged
Marc-André Moreau (mamoreau-devolutions) merged 1 commit intomasterfrom
perf-improvements
Mar 12, 2026
Merged

Optimize parsing, filtering, and rendering performance#27
Marc-André Moreau (mamoreau-devolutions) merged 1 commit intomasterfrom
perf-improvements

Conversation

@mamoreau-devolutions

Summary

This PR reduces allocation and CPU overhead across parsing, filtering, query execution, and table rendering in cirup_core.

Highlights:

  • Replace regex-backed text filter compilation and matching with a purpose-built matcher for the supported pattern subset.
  • Replace prettytable-rs table rendering with a manual ASCII formatter while preserving the existing output layout.
  • Remove dot_json-based JSON flattening in favor of direct recursive flattening.
  • Replace the RESTEXT regex parser with a manual parser and direct writer.
  • Reduce RESX escaping and parsing allocations by writing escapes directly into output buffers and iterating parsed nodes directly.
  • Reuse fast in-memory query execution for rusqlite-backed queries and avoid extra row cloning when reading DB results.
  • Preallocate file reads and avoid redundant UTF-8 output copies when writing resource files.

Benchmark Highlights

  • Query filter compilation (5,000 key patterns + 5,000 value patterns): ~1.251s -> ~2.451ms
  • Filter pass on 50,000 resources with key and value filters: ~2.57ms -> ~1.71ms
  • Repeated resource table rendering (20,000 iterations): ~102.6ms -> ~13.3ms
  • Repeated report table rendering (20,000 iterations): ~193.1ms -> ~26.5ms

Validation

  • cargo fmt --all
  • cargo test --workspace
  • cargo clippy --workspace --all-targets

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) merged commit c8d2271 into master Mar 12, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant