MCPcopy Create free account
hub / github.com/FastLED/FastLED / _resolve_fast_native_cxx

Function _resolve_fast_native_cxx

ci/iwyu_wrapper.py:47–68  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

45
46
47def _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
71def get_compiler_include_paths(compiler_path: str) -> list[str]:

Callers 1

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected