Skip to content

perf: anonymize files in parallel with a process pool#23

Merged
armand0e merged 2 commits into
TeichAI:mainfrom
CompactAIOfficial:perf/anonymize-parallel
Jul 10, 2026
Merged

perf: anonymize files in parallel with a process pool#23
armand0e merged 2 commits into
TeichAI:mainfrom
CompactAIOfficial:perf/anonymize-parallel

Conversation

@CompactAIOfficial

Copy link
Copy Markdown
Contributor

Directory anonymization processed files strictly sequentially, but each file already gets its own TraceAnonymizer instance (replacement maps are per-trace by design), so files are fully independent.

This fans the per-file work out over a ProcessPoolExecutor sized to os.cpu_count() (falling back to 1 when unavailable — no hardware assumptions). Batches under 8 files keep the sequential path, since process startup would cost more than it saves. Report ordering, per-file scoping, and output are unchanged; executor.map preserves the sorted file order.

Testing

  • pytest tests/test_extract_anonymize_cli.py — 32 passed
  • 24-file synthetic export: all 7200 seeded keys redacted, per-file report order preserved

🤖 Generated with Claude Code

Each file gets its own TraceAnonymizer, so files are fully independent
and can be processed concurrently. Directory anonymization now fans out
over a ProcessPoolExecutor sized to the machine's CPU count, falling
back to the sequential path for small batches where process startup
would cost more than it saves.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f5b6e4dc6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/teich/anonymize.py Outdated
@armand0e
armand0e merged commit 25de0c5 into TeichAI:main Jul 10, 2026
3 checks passed
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