mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
`Server.cpp` included `StorageReplicatedMergeTree.h` but never used the `StorageReplicatedMergeTree` class directly. The only dependency was on `MergeTreeBackgroundExecutor` for thread pool management (accessed via `Context::getMergeMutateExecutor` etc.). `StorageReplicatedMergeTree.h` is an extremely heavy header that transitively pulls in `MergeTreeData.h`, `SortCursor.h` (with expensive `std::variant` instantiations for sorting queues), `MergeTask.h`, `MergeFromLogEntryTask.h`, `TextIndexUtils.h`, and `DataPartsExchange.h`. The time trace showed 3.9s just for parsing `StorageReplicatedMergeTree.h` plus ~4.3s of template instantiations from `SortCursor.h` variant types. Replacing it with the targeted `MergeTreeBackgroundExecutor.h` reduces `Server.cpp.o` compile time from 34.8s to 28.1s (-19%). Since `Server.cpp` is on the critical path (last .o file to finish before linking), this directly reduces wall time. Build time: 5m6.0s (was 5m16.7s, -10.7s / -3.4%) Co-Authored-By: Claude Opus 4.6 <[email protected]>