summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-11-18 15:44:17 -0500
committerGitHub <noreply@github.com>2024-11-18 20:44:17 +0000
commit19bbf83e47e4f98a45fe1c735dd2cdab80b99eca (patch)
tree6cbe7ad98de88cbe8a01669be3a7120ed80613c0 /cli
parentdd4570ed85888d9659a2eec98437dbd6de4a5799 (diff)
perf(windows): delay load webgpu and some other dlls (#26917)
Before: ~100ms, After: ~40ms for a hello world Closes https://github.com/denoland/deno/issues/26914
Diffstat (limited to 'cli')
-rw-r--r--cli/build.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 2678a8dbb..3d9866128 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -400,6 +400,24 @@ fn main() {
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
+ if cfg!(windows) {
+ // these dls load slowly, so delay loading them
+ let dlls = [
+ // webgpu
+ "d3dcompiler_47",
+ "OPENGL32",
+ // network related functions
+ "iphlpapi",
+ ];
+ for dll in dlls {
+ println!("cargo:rustc-link-arg-bin=deno=/delayload:{dll}.dll");
+ println!("cargo:rustc-link-arg-bin=denort=/delayload:{dll}.dll");
+ }
+ // enable delay loading
+ println!("cargo:rustc-link-arg-bin=deno=delayimp.lib");
+ println!("cargo:rustc-link-arg-bin=denort=delayimp.lib");
+ }
+
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());