[MDEV-27813] Windows, compiling : RelWithDebInfo should use /Ob2 for more aggresive inlining Created: 2022-02-11  Updated: 2022-02-13  Resolved: 2022-02-11

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Platform Windows, Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.5.16, 10.6.8, 10.7.4, 10.8.3

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None


 Description   

By CMake's default, RelWithDebInfo compiles with /Ob1 option, which is inlining everything that is marked for inlining but nothing else (see reference). However certain template function in the SDK are not explicitely marked inline. Which makes compiler to create non-inlined functions. In some situations this does not work very well . For example atomic store (including memory_order_relaxed) would call a template function Atomic_reinterpret_as() ,which was compiled for some template parameters, to a dummy function.

If more agressive inlining is enabled, like /Ob2 (default for Release/MinSizeRel), then Atomic_reinterpret_as generates no instructions.

Given Innodb's extensive use for atomics (specifically relaxed ones, to please TSAN), the call() instruction overhead on every load of atomic becomes too high, and measurable in recent 10.8 benchmarks, as much as 5-10%.


Generated at Thu Feb 08 09:55:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.