-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace static_lazy<> with normal statics #471
Comments
magic statics have some overhead that some components, dlls that are loaded in many processes, what to avoid. |
I'd like to understand that overhead and take feature requests to the CRT team if necessary. Magic statics are the intended language tool for this problem. Do you have examples of swapping init_once to magic statics so we can see the impact? |
I was under the impression that statics use You're also already paying that cost anyways, because this is how it's used currently: wil/include/wil/Tracelogging.h Line 2287 in 6f60a1b
|
wil/include/wil/Tracelogging.h
Lines 188 to 204 in eb9eb35
According to https://learn.microsoft.com/en-us/cpp/cpp/storage-classes-cpp?view=msvc-170, function-local "magic statics" are fully supported.
Instead of defining a custom static_lazy type, use the built-in support.
Instance()
method:The text was updated successfully, but these errors were encountered: