It turns out that the previous code construct was not optimizing the allocation
and deallocation of batches. The class id was read as a class member (even
though a precomputed one) and nothing else was optimized. By changing the
construct this way, the compiler actually optimizes most of the allocation and
deallocation away to only work with a single class id, which not only saves some
CPU but also some code footprint.
Details
Details
Diff Detail
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
Comment Actions
- const uptr BatchClassId = SizeClassMap::ClassID(sizeof(QuarantineBatch));
Shouldn't it be constexpr? Or at least static const?
Comment Actions
SizeClassMap::ClassID can't be made C++11 constexpr due to branches, so BatchClassId can't be made constexpr.
Making it static const makes the compiler use __cxa_guard_acquire & __cxa_guard_release which we don't want to be able to stay free of libc++ dependencies.
Comment Actions
Making it static const makes the compiler use cxa_guard_acquire & cxa_guard_release which we don't want to be able to stay free of libc++ dependencies.
I meant keeping it as class member (not making it function-local static).
Comment Actions
Sorry for the misunderstanding.
As a class member constexpr doesn't work for the previously mentioned reasons, and static const complains that the function SizeClassMap::ClassId is non-constexpr.