perf: memoize setupLLVMWithoutActivation

This commit is contained in:
Amin Yahyaabadi 2023-07-24 15:48:38 -07:00
parent 10c725c53f
commit bc25e4e3b4
7 changed files with 17 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,10 +22,7 @@ export async function setupLLVM(version: string, setupDir: string, arch: string)
return installationInfo return installationInfo
} }
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */ async function setupLLVMWithoutActivation_raw(version: string, setupDir: string, arch: string) {
export const setupClangTools = setupLLVMWithoutActivation
async function setupLLVMWithoutActivation(version: string, setupDir: string, arch: string) {
// install LLVM and its dependencies in parallel // install LLVM and its dependencies in parallel
const [installationInfo, _1, _2] = await Promise.all([ const [installationInfo, _1, _2] = await Promise.all([
setupLLVMOnly(version, setupDir, arch), setupLLVMOnly(version, setupDir, arch),
@ -35,6 +32,10 @@ async function setupLLVMWithoutActivation(version: string, setupDir: string, arc
return installationInfo return installationInfo
} }
const setupLLVMWithoutActivation = memoize(setupLLVMWithoutActivation_raw, { isPromise: true })
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
export const setupClangTools = setupLLVMWithoutActivation
async function setupLLVMOnly(version: string, setupDir: string, arch: string) { async function setupLLVMOnly(version: string, setupDir: string, arch: string) {
const coeredVersion = semverCoerceIfInvalid(version) const coeredVersion = semverCoerceIfInvalid(version)