Skip to content

Commit c1a2645

Browse files
committed
change build defaults
1 parent 79f0de6 commit c1a2645

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎scripts/clangd/build.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ wasi_include="$CLANGD_BUILD_ROOT/wasi-sysroot-$WASI_SDK_VERSION/include"
103103
cp -R "build/lib/clang/$LLVM_MAJOR/include/." "$wasi_include/"
104104

105105
## Re-link the production build with the sysroot embedded.
106-
configure_clangd "-pthread -s ENVIRONMENT=worker -s NO_INVOKE_RUN -s EXIT_RUNTIME -s INITIAL_MEMORY=2GB -s ALLOW_MEMORY_GROWTH -s MAXIMUM_MEMORY=4GB -s STACK_SIZE=256kB -s EXPORTED_RUNTIME_METHODS=FS,callMain -s MODULARIZE -s EXPORT_ES6 -s WASM_BIGINT -s ASSERTIONS -s ASYNCIFY -s PTHREAD_POOL_SIZE='Math.max(navigator.hardwareConcurrency, 8)' --embed-file=$wasi_include@/usr/include"
106+
configure_clangd "-pthread -s ENVIRONMENT=worker -s NO_INVOKE_RUN -s EXIT_RUNTIME -s INITIAL_MEMORY=256MB -s ALLOW_MEMORY_GROWTH -s MAXIMUM_MEMORY=2GB -s STACK_SIZE=256kB -s EXPORTED_RUNTIME_METHODS=FS,callMain -s MODULARIZE -s EXPORT_ES6 -s WASM_BIGINT -s ASSERTIONS -s ASYNCIFY -s PTHREAD_POOL_SIZE=8 --embed-file=$wasi_include@/usr/include"
107107
cmake --build build --target clangd
108108

109109
mkdir -p "$clangd_wasm_dir"

‎src/clangd/worker.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ async function start(): Promise<void> {
151151
`${WORKSPACE_PATH}/.clangd`,
152152
JSON.stringify({ CompileFlags: { Add: flags } }),
153153
);
154-
clangd.callMain([]);
154+
// One clangd process serves every editor model, so a single asynchronous
155+
// worker avoids scaling its internal thread demand with the host CPU count.
156+
clangd.callMain(["-j=1"]);
155157

156158
const reader = new BrowserMessageReader(self);
157159
writer = new BrowserMessageWriter(self);

0 commit comments

Comments
 (0)