-
Notifications
You must be signed in to change notification settings - Fork 99
Description
It appears that some inadvertent changes have disabled the effect of the VARIANT_INLINE
macro in debug builds on Windows and release builds on all other platforms, by commenting out the replacement text of the macro.
variant/include/mapbox/variant.hpp
Line 39 in 256ddd5
# define VARIANT_INLINE //__declspec(noinline) |
variant/include/mapbox/variant.hpp
Line 43 in 256ddd5
# define VARIANT_INLINE //inline __attribute__((always_inline)) |
In those cases, the methods tagged with VARIANT_INLINE
were inlined or not according to the default behavior of the compiler and optimization settings.
In my tests with mapbox-gl-native, removing the comments and thus restoring VARIANT_INLINE
to its intended function in the release build causes a 2.5% size increase in the resulting binary (Apple clang 9, building with -Os
):
VM SIZE FILE SIZE
-------------- --------------
+3.9% +116Ki __TEXT,__text +116Ki +3.9%
+283% +2.50Ki Table of Non-instructions +2.50Ki +283%
+2.2% +1.36Ki Code Signature +1.36Ki +2.2%
+11% +368 [__LINKEDIT] 0 [ = ]
+0.0% +48 __TEXT,__const +48 +0.0%
-1.2% -224 Function Start Addresses -224 -1.2%
-2.2% -1.66Ki __TEXT,__unwind_info -1.66Ki -2.2%
-56.1% -1.89Ki [__TEXT] -1.89Ki -56.7%
-2.3% -9.11Ki __TEXT,__gcc_except_tab -9.11Ki -2.3%
+2.5% +108Ki TOTAL +107Ki +2.5%
I suggest we remove the VARIANT_INLINE
macro entirely, the rationale being:
- The compiler is best positioned to determine whether or not to inline these methods, based on program analysis and the developer's chosen optimization settings.
VARIANT_INLINE
has effectively been a no-op in release builds on the majority of platforms since 372d7c8, and we haven't noticed any issues with that.- Restoring it to force inlining in release builds seems to increase the binary size, the opposite of the desired effect.