zig/lib
Ryan Liptak 70058471e3 WindowsSdk: Use ntdll instead of advapi32 APIs for registry querying
The dependency on advapi32.dll actually silently brings along 3 other dlls at runtime (msvcrt.dll, sechost.dll, bcrypt.dll), even if no advapi32 APIs are called. So, this commit actually reduces the number of dlls loaded at runtime by 4 (but only when LLVM is not linked, since LLVM has its own dependency on advapi32.dll).

The data is not super conclusive, but the ntdll version of WindowsSdk appears to run slightly faster than the previous advapi32 version:

Benchmark 1: libc-ntdll.exe ..
  Time (mean ± σ):       6.0 ms ±   0.6 ms    [User: 3.9 ms, System: 7.1 ms]
  Range (min … max):     4.8 ms …   7.9 ms    112 runs

Benchmark 2: libc-advapi32.exe ..
  Time (mean ± σ):       7.2 ms ±   0.5 ms    [User: 5.4 ms, System: 9.2 ms]
  Range (min … max):     6.1 ms …   8.9 ms    103 runs

Summary
  'libc-ntdll.exe ..' ran
    1.21 ± 0.15 times faster than 'libc-advapi32.exe ..'

and this mostly seems to be due to changes in the implementation (the advapi32 APIs do a lot of NtQueryKey calls that the new implementation doesn't do) rather than due to the decrease in dll loading. LLVM-less zig binaries don't show the same reduction (the only difference here is the DLLs being loaded):

Benchmark 1: stage4-ntdll\bin\zig.exe version
  Time (mean ± σ):       3.0 ms ±   0.6 ms    [User: 5.3 ms, System: 4.8 ms]
  Range (min … max):     1.3 ms …   4.2 ms    112 runs

Benchmark 2: stage4-advapi32\bin\zig.exe version
  Time (mean ± σ):       3.5 ms ±   0.6 ms    [User: 6.9 ms, System: 5.5 ms]
  Range (min … max):     2.5 ms …   5.9 ms    111 runs

Summary
  'stage4-ntdll\bin\zig.exe version' ran
    1.16 ± 0.28 times faster than 'stage4-advapi32\bin\zig.exe version'

---

With the removal of the advapi32 dependency, the non-ntdll dependencies that remain in an LLVM-less Zig binary are ws2_32.dll (which brings along rpcrt4.dll at runtime), kernel32.dll (which brings along kernelbase.dll at runtime), and crypt32.dll (which brings along ucrtbase.dll at runtime).
2026-03-03 01:12:47 -08:00
..
build-web std.Io.{Writer|Duration}: move duration formatting to a format method 2026-02-28 02:46:04 +01:00
c libc malloc: introduce a canary 2026-02-14 09:25:41 +01:00
compiler Merge pull request 'rework fuzz testing to be smith based' (#31205) from gooncreeper/zig:integrated-smith into master 2026-02-25 20:23:36 +01:00
compiler_rt compiler_rt: Implemented missing handling of denormal numbers when dividing f128 (#30198) 2026-02-13 20:49:14 +01:00
docs fix(docs/wasm):zig std html render error function 'a' 2026-02-27 19:17:47 +01:00
include remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
init rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
libc zig libc: acosf 2026-02-13 11:30:14 -08:00
libcxx libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set 2025-11-14 02:02:59 +01:00
libcxxabi remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libtsan remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libunwind remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
std WindowsSdk: Use ntdll instead of advapi32 APIs for registry querying 2026-03-03 01:12:47 -08:00
c.zig libc: implement insque and remque in Zig 2026-02-12 21:35:36 -08:00
compiler_rt.zig compiler_rt: common -> compiler_rt 2026-02-09 20:03:15 -08:00
fuzzer.zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
ubsan_rt.zig Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
zig.h std.Threaded: replace more kernel32 functions with ntdll 2026-02-07 00:02:50 -05:00