You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
magic statics have some overhead that some components, dlls that are loaded in many processes, what to avoid.
using wil::init_once avoids that, at the cost of more complicated code. is that your understanding?
magic statics have some overhead that some components, dlls that are loaded in many processes, what to avoid. using wil::init_once avoids that, at the cost of more complicated code. is that your understanding?
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 InitOnceBeginInitialize or something equivalent, and that using static_lazy would basically just be replacing automatic overhead with manual overhead.
You're also already paying that cost anyways, because this is how it's used currently:
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: