Conversation
|
@Extrodox is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Overlaps merged #1071 watcher sync and conflicts with current watcher.py. |
# Conflicts: # src/codegraphcontext/core/watcher.py
main added _update_lock/_timers_lock after this branch was cut (CodeGraphContext#1424, serialising concurrent watcher updates). Tests that build the handler via __new__ must set them, as the neighbouring tests in this file already do.
|
Rebased onto current
Why I have not merged itThe parallel parsing hits an open segfault bug — #1370. That issue reports non-deterministic Your # utils/tree_sitter_manager.py:322
def execute_query(language, query_string, node):
query = Query(language, query_string) # per call, no lock
cursor = QueryCursor(query)
res = cursor.captures(node)
So merging this would move a known crash from What would unblock itEither is fine, and either would be a genuinely valuable PR on its own:
The rest of the PR is good — reusing the already-parsed changed file is a clear win regardless, and if you wanted to split that out as its own PR it would merge immediately. Keeping this open as a draft. |
|
#1370 is now fixed — #1593 merged, adding a process-wide lock around tree-sitter query construction and execution. That was the blocker on this PR. Measured cost of the lock is ~1% (3.48s vs 3.45s median over 120 parses on 8 threads), because only the query step is serialised — One caveat I want to be straight about: I could not reproduce the segfault locally, so #1593 is a guard against the reported crash rather than one I demonstrated. It is not proof your parallelism is now safe — it removes the specific unsynchronised path the report pointed at. Your branch is already rebased onto |
|
This is still marked as a draft, so I've left it alone — flagging that it's now conflict-free against |
Summary
update_file_in_graph()instead of parsing the same file again during incremental relinking.ThreadPoolExecutordriven byPARALLEL_WORKERS.Why
Incremental indexing was effectively serial for affected-file parsing, and the changed file could be parsed twice in one update pass. This makes large affected sets slower than necessary even when parsing work is CPU-bound and independent per file.
Validation
PYTHONPATH=src /tmp/cgc-pr-venv/bin/python -m pytest tests/unit/tools/test_graph_builder_perf_fixes.py::TestWatcherIncrementalHandleModification::test_incremental_parse_workers_uses_parallel_workers_config tests/unit/tools/test_graph_builder_perf_fixes.py::TestWatcherIncrementalHandleModification::test_handle_modification_reuses_changed_file_parse_result -qPYTHONPATH=src /tmp/cgc-pr-venv/bin/python -m compileall -q src/codegraphcontext/core/watcher.pyNote: the default Homebrew Python in this shell is externally managed and lacked project dependencies, so validation used a temporary venv under
/tmp/cgc-pr-venv.