Skip to content

Commit bc25e4e

Browse files
committed
perf: memoize setupLLVMWithoutActivation
1 parent 10c725c commit bc25e4e

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

dist/actions/setup-cpp.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/llvm/llvm.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ export async function setupLLVM(version: string, setupDir: string, arch: string)
2222
return installationInfo
2323
}
2424

25-
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
26-
export const setupClangTools = setupLLVMWithoutActivation
27-
28-
async function setupLLVMWithoutActivation(version: string, setupDir: string, arch: string) {
25+
async function setupLLVMWithoutActivation_raw(version: string, setupDir: string, arch: string) {
2926
// install LLVM and its dependencies in parallel
3027
const [installationInfo, _1, _2] = await Promise.all([
3128
setupLLVMOnly(version, setupDir, arch),
@@ -35,6 +32,10 @@ async function setupLLVMWithoutActivation(version: string, setupDir: string, arc
3532

3633
return installationInfo
3734
}
35+
const setupLLVMWithoutActivation = memoize(setupLLVMWithoutActivation_raw, { isPromise: true })
36+
37+
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
38+
export const setupClangTools = setupLLVMWithoutActivation
3839

3940
async function setupLLVMOnly(version: string, setupDir: string, arch: string) {
4041
const coeredVersion = semverCoerceIfInvalid(version)

0 commit comments

Comments
 (0)