Skip to content

perf: optimize core function paths across indexing, search, cache, and MCP interface#15

Open
DevvGwardo wants to merge 7 commits into
MisterGuy420:mainfrom
DevvGwardo:perf/optimize-all-functions-20260302-183342
Open

perf: optimize core function paths across indexing, search, cache, and MCP interface#15
DevvGwardo wants to merge 7 commits into
MisterGuy420:mainfrom
DevvGwardo:perf/optimize-all-functions-20260302-183342

Conversation

@DevvGwardo

Copy link
Copy Markdown
Contributor

Summary

This PR applies broad function-level optimizations and correctness hardening across Peppy’s hot paths.

What changed

1) Cache performance + correctness (peppy/cache.py)

  • Switched cache keying from MD5 to SHA256.
  • Added optional ttl_seconds support.
  • Added index freshness signature validation (file count + size + max mtime fingerprint) to reduce stale cache usage.
  • Standardized UTF-8 read/write paths.

2) Indexer optimization (peppy/indexer.py)

  • Optimized ignore checks via pre-split exact vs glob ignore patterns.
  • Normalized gitignore matching using relative POSIX paths.
  • Added adaptive worker defaults for better CPU utilization on modern hosts.
  • Precomputed/stored symbol_types and file_extensions in index metadata.

3) Searcher optimization (peppy/searcher.py)

  • Added max_results support to search_symbols() with early termination.
  • Improved file pattern matching reliability (relative path + basename + full path).
  • Fixed get_file_symbols() relative path behavior by resolving against codebase root.
  • Reduced grep overhead and builds context payload only when requested.
  • Reuses precomputed stats from index when available.

4) Parser correctness fix (peppy/parsers.py)

  • Fixed AST traversal context leakage so class context is scoped per branch and siblings are not misclassified.

5) Interface/MCP tool-path optimization (peppy/interface.py, peppy/server.py)

  • find_symbols() now pushes limits down to search layer (max_results) instead of slicing after full search.
  • Tightened overview entrypoint symbol queries for better token/latency behavior.
  • Added max_results to MCP search_symbols schema and execution flow.

6) Packaging entrypoint correctness (pyproject.toml)

  • Updated script entrypoint from peppy.server:main to peppy.server:run.

Why

  • Lower end-to-end latency and compute overhead on large repos.
  • Improve symbol/search correctness and cache freshness.
  • Better behavior for Claude/MCP workflows under heavier usage.

Scope

  • Backward-compatible API changes (new optional arguments and tighter internals).
  • No intended breaking behavior for existing users.

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.

1 participant