Skip to content

perf: update and optimize core functions end-to-end (cache/index/search/interface/server)#16

Open
DevvGwardo wants to merge 9 commits into
MisterGuy420:mainfrom
DevvGwardo:perf/update-all-functions-20260302-185532
Open

perf: update and optimize core functions end-to-end (cache/index/search/interface/server)#16
DevvGwardo wants to merge 9 commits into
MisterGuy420:mainfrom
DevvGwardo:perf/update-all-functions-20260302-185532

Conversation

@DevvGwardo

Copy link
Copy Markdown
Contributor

Summary

This PR performs a broad optimization + correctness pass across Peppy core functions and hardens related tests.

Phase results

  • Parallel analysis completed (structure + code scouts)
  • Changes synthesized and applied to high-impact runtime paths
  • Branch created and files committed
  • PR opened immediately

Core code updates

peppy/cache.py

  • Upgraded cache key hash to sha256.
  • Added optional ttl_seconds support.
  • Added cache freshness signature checks against indexed files to reduce stale index reuse.
  • Standardized UTF-8 read/write handling.

peppy/indexer.py

  • Optimized ignore logic by splitting exact patterns vs glob patterns.
  • Normalized gitignore checks against relative POSIX paths.
  • Added adaptive worker sizing for indexing throughput.
  • Precomputes/stores symbol_types and file_extensions in index metadata.

peppy/searcher.py

  • Added max_results to search_symbols() with early termination.
  • Improved file pattern matching (relative path, basename, and full path checks).
  • Fixed get_file_symbols() so relative file paths resolve from codebase root.
  • Reduced grep overhead and only builds context payload when requested.
  • Reuses precomputed stats when available.

peppy/parsers.py

  • Fixed AST traversal context leakage by scoping class context per branch (prevents sibling misclassification).

peppy/interface.py

  • Pushes symbol limits down to search layer (max_results) instead of slicing after full scan.
  • Tightened overview entrypoint query patterns and caps for lower overhead.
  • Reuses precomputed index stats when present.

peppy/server.py

  • Added max_results to MCP search_symbols schema.
  • Wired max_results into runtime search execution.

pyproject.toml

  • Corrected CLI entrypoint from peppy.server:main to peppy.server:run.

Test hardening

tests/unit/test_parsers.py

  • Fixed no-op assertion (classes[0].name == ... -> real assert).
  • Removed effectively-always-true assertion and replaced with meaningful symbol assertion.

tests/unit/test_searcher.py

  • Updated symbol-limit test to validate real max_results behavior.
  • Added regression test for relative file path resolution against codebase root.

Why

  • Improve runtime performance and scalability on larger codebases.
  • Fix correctness gaps in path resolution, parser classification, and cache freshness.
  • Improve confidence via stronger regression tests.

Compatibility

  • Changes are backward-compatible; new parameters are optional.
  • Existing workflows should continue to function with improved behavior.

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