You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow concurrent parsing of the same grammar during indexing #127
PR #126 (#115) parallelizes per-file indexing, but chunk() in crates/csp/src/chunking/core.rs holds a per-grammar mutex around Parser::new, set_language, and parse. Files of the same language therefore still parse one at a time. On a repository dominated by one language, the speedup comes only from reading, hashing, merging, and tokenizing.
The lock exists because the language pack serializes all parsing behind a global PARSE_LOCK ("some third-party grammar scanner code keeps process-global mutable state"), and upstream semble sidesteps the issue with worker processes. The per-grammar lock is already more concurrent than the language pack's own default.
Proposal
Identify which grammars' external scanners actually keep process-global state, and keep an allowlist of grammars that are safe to parse concurrently (or a denylist of unsafe ones).
Alternatively, keep a per-thread parser pool for grammars known to be safe.
Add a single-language benchmark case (for example 300 .ts files) next to the existing multi-language index_build bench, so the effect is measurable.
Activity