Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows: manually initialize NewNTUnicodeString
The `RtlInitUnicodeString` syscall can be avoided by manually initializing the `NTUnicodeString`. The process is described in [WdmlibRtlInitUnicodeStringEx](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdmsec/nf-wdmsec-wdmlibrtlinitunicodestringex). The less syscalls, the better. It also makes the function faster: ``` goos: windows goarch: amd64 pkg: golang.org/x/sys/windows cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ NewNTUnicodeString-12 181.05n ± 15% 96.32n ± 11% -46.80% (p=0.000 n=10) ``` Change-Id: Iaf079acdcc2024cdca6b6b649a711f6be99c5b87 Reviewed-on: https://go-review.googlesource.com/c/sys/+/618175 Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
- Loading branch information