Skip to content

Conversation

@Wraith2
Copy link
Contributor

@Wraith2 Wraith2 commented Jan 3, 2020

While profiling the managed SNI implementation I got distracted by the amount of time it takes to get a connection from the pool. I found this simple change which on windows removes 2 pinvokes and a string allocation by getting the user domain name only once and reusing it.

comparison

If we were doing direct invokes instead of using System.Environment wrappers we could do it in 2-3 pinvokes and avoid a couple of string allocations. We would have to be platform specific though and I'd prefer to keep this implementation fully portable if possible. Note that the Environment.UserName and UseDomainName functions do not read environment variables the pinvoke directly so they are compatible with impersonation, any replacement would need to have the same property.

@cheenamalhotra cheenamalhotra added this to the 2.0.0-preview1 milestone Jan 6, 2020
@cheenamalhotra cheenamalhotra merged commit c636056 into dotnet:master Jan 6, 2020
@Wraith2 Wraith2 deleted the perf-managedpoolspeed branch January 8, 2020 19:13
@cheenamalhotra cheenamalhotra added the Performance 📈 Issues that are targeted to performance improvements. label Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance 📈 Issues that are targeted to performance improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants