What does NS_BEGIN_COLD_REGION do
Hello,
I'm having a hard time finding what NS_BEGIN_COLD_REGION does?
Why it's used in samples, removing/not using it seems to have no ill effects?
Is there a common docs page for existing macros?
Cheers.
I'm having a hard time finding what NS_BEGIN_COLD_REGION does?
Why it's used in samples, removing/not using it seems to have no ill effects?
Is there a common docs page for existing macros?
Cheers.
Re: What does NS_BEGIN_COLD_REGION do
We use this macro to mark blocks of code that should be explicitly optimized for size. They are used when implementing the reflection of each class, because even if you are optimizing for speed, the reflection is only executed once and it doesn't make sense to optimize that for speed.
This is a poor approach to PGO (Profile-Guided Optimization). For companies with access to source code like yours, we recommend directly injecting our cpps in your project (we are working to improve this step by having just a few unity files containing all our API) and compiling with PGO enabled to get the best balance between size and speed.
Just inspecting CompilerSettings.h you can see the definitions for Visual Studio:
And for GCC / Clang:
This is a poor approach to PGO (Profile-Guided Optimization). For companies with access to source code like yours, we recommend directly injecting our cpps in your project (we are working to improve this step by having just a few unity files containing all our API) and compiling with PGO enabled to get the best balance between size and speed.
Just inspecting CompilerSettings.h you can see the definitions for Visual Studio:
Code: Select all
#define NS_BEGIN_COLD_REGION __pragma(optimize("s", on))
#define NS_END_COLD_REGION __pragma(optimize("", on))
#define NS_COLD_FUNC
Code: Select all
#define NS_BEGIN_COLD_REGION
#define NS_END_COLD_REGION
#define NS_COLD_FUNC __attribute__((cold, minsize))
Who is online
Users browsing this forum: Semrush [Bot] and 67 guests