Skip to content

Commit e851aeb

Browse files
committed
scudo: Re-order Allocator fields for improved performance. NFCI.
Move smaller and frequently-accessed fields near the beginning of the data structure in order to improve locality and reduce the number of instructions required to form an access to those fields. With this change I measured a ~5% performance improvement on BM_malloc_sql_trace_default on aarch64 Android devices (Pixel 4 and DragonBoard 845c). Differential Revision: https://reviews.llvm.org/D88350
1 parent 54759ce commit e851aeb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler-rt/lib/scudo/standalone/combined.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,12 +950,6 @@ class Allocator {
950950

951951
static const uptr MaxTraceSize = 64;
952952

953-
GlobalStats Stats;
954-
TSDRegistryT TSDRegistry;
955-
PrimaryT Primary;
956-
SecondaryT Secondary;
957-
QuarantineT Quarantine;
958-
959953
u32 Cookie;
960954

961955
struct {
@@ -968,6 +962,12 @@ class Allocator {
968962
u32 QuarantineMaxChunkSize; // quarantine_max_chunk_size
969963
} Options;
970964

965+
GlobalStats Stats;
966+
PrimaryT Primary;
967+
SecondaryT Secondary;
968+
QuarantineT Quarantine;
969+
TSDRegistryT TSDRegistry;
970+
971971
#ifdef GWP_ASAN_HOOKS
972972
gwp_asan::GuardedPoolAllocator GuardedAlloc;
973973
#endif // GWP_ASAN_HOOKS

0 commit comments

Comments
 (0)