Skip to content

Performance + first-class email/name/phone strategies#55

Merged
ababic merged 2 commits into
mainfrom
cursor/performance-optimizations-bff5
May 3, 2026
Merged

Performance + first-class email/name/phone strategies#55
ababic merged 2 commits into
mainfrom
cursor/performance-optimizations-bff5

Conversation

@ababic

@ababic ababic commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

Performance work on the SQL hot path (previous revision) plus first-class PII strategies restored in config and runtime, with faker/phone random-path optimizations.

Performance (SQL / I/O)

  • 256 KiB buffered I/O; fewer allocations on INSERT/COPY row filters and statement scanning; case-insensitive keyword search without full-string to_uppercase; lighter INSERT output building.

Strategies (PII)

  • email, name, first_name, last_name are again real KNOWN_STRATEGIES entries. Config is no longer rewritten to strategy = "faker" at resolve time; faker is only required when using the open-ended faker allowlist.
  • phone was already first-class; validation now allows locale on the name/email strategies too.
  • resolve() lowercases strategy strings on load so Email / EMAIL behave like email.

Faker / RNG optimizations

  • AnonymizerRegistry holds a RefCell<StdRng> seeded once (make_random_rng at registry construction) and reuses it for random-path faker, phone, and built-in PII strategies (no per-cell StdRng::from_seed).
  • resolved_locale_key in faker_dispatch avoids allocating a String for locale on every faker call when defaulting to en or when the value is already a known key.

Docs / examples

  • README strategy table and snippets; .dumplingconf.example; CHANGELOG [Unreleased]; settings field docs.

Testing

  • cargo test --all-targets --all-features
  • cargo clippy --all-targets --all-features
  • cargo fmt --all -- --check

Slack Thread

Open in Web Open in Cursor 

cursoragent and others added 2 commits May 3, 2026 14:36
- Use 256 KiB BufReader/BufWriter for file and pipe I/O to cut syscalls.
- Avoid full-string to_uppercase for INSERT detection and VALUES search;
  add ASCII case-insensitive find and prefix checks.
- statement_complete: iterate chars without collecting Vec<char>.
- parse_parenthesized_values: char_indices iterator instead of Vec<char>.
- Row filters and column_cases: pass &[Option<&str>] to avoid per-row
  String clones for COPY and INSERT; only allocate when JSON paths need owned strings.
- INSERT output: pre-size String, manual comma join; skip stmt.to_string() for disabled tables.

Co-authored-by: Andy Babic <ababic@users.noreply.github.com>
…ker path

- Add email, name, first_name, last_name to KNOWN_STRATEGIES; stop rewriting
  them to faker at resolve time; lowercase strategy names in resolve().
- Transform: dedicated match arms calling shared pii_* helpers in
  faker_dispatch; deterministic path unchanged except locale via
  resolved_locale_key.
- AnonymizerRegistry: RefCell<StdRng> reused for random-path faker, phone,
  and PII strategies (no per-cell StdRng::from_seed).
- faker_dispatch: resolved_locale_key (no String alloc for default/en);
  faker_string_with_rng uses it; add pii_* + pii_phone_number exports.
- sql infer_auto_strategy uses built-in strategies; drop unused faker_spec.
- Docs: README table and examples; CHANGELOG Unreleased; .dumplingconf.example.

Co-authored-by: Andy Babic <ababic@users.noreply.github.com>
@cursor cursor Bot changed the title Performance: fewer allocations on SQL hot path, larger I/O buffers Performance + first-class email/name/phone strategies May 3, 2026
@ababic ababic marked this pull request as ready for review May 3, 2026 14:54
@ababic ababic merged commit 225cb5a into main May 3, 2026
10 checks passed
@ababic ababic deleted the cursor/performance-optimizations-bff5 branch May 3, 2026 15:36
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.

2 participants