Swap a slow Python-wrapped C++ driver for the cached native launcher. The `clang-tool-chain-cpp` Python entry point pays ~828ms of interpreter startup before clang even runs (per the meson native-file optimization, repo memory 2026-03-07). The repo's build system pre-compiles a native
(compiler_path: str)
| 45 | |
| 46 | |
| 47 | def _resolve_fast_native_cxx(compiler_path: str) -> str: |
| 48 | """Swap a slow Python-wrapped C++ driver for the cached native launcher. |
| 49 | |
| 50 | The `clang-tool-chain-cpp` Python entry point pays ~828ms of interpreter |
| 51 | startup before clang even runs (per the meson native-file optimization, |
| 52 | repo memory 2026-03-07). The repo's build system pre-compiles a native |
| 53 | launcher at `.cached/clang-native/ctc-clang++.exe` that avoids this |
| 54 | overhead (~100ms vs ~1068ms for the same `-E -v` stdlib probe). |
| 55 | |
| 56 | If the cached native launcher exists and the requested driver is the |
| 57 | slow Python wrapper, return the cached path. Otherwise, return the |
| 58 | original path unchanged. |
| 59 | """ |
| 60 | name = Path(compiler_path).name.lower() |
| 61 | if "clang-tool-chain-cpp" not in name and "clang-tool-chain-c-msvc" not in name: |
| 62 | return compiler_path |
| 63 | repo_root = Path(__file__).resolve().parent.parent |
| 64 | suffix = ".exe" if sys.platform == "win32" else "" |
| 65 | cached = repo_root / ".cached" / "clang-native" / f"ctc-clang++{suffix}" |
| 66 | if cached.is_file(): |
| 67 | return str(cached) |
| 68 | return compiler_path |
| 69 | |
| 70 | |
| 71 | def get_compiler_include_paths(compiler_path: str) -> list[str]: |
no test coverage detected