[P0] common/ を静的ライブラリ化する - #39
Merged
Merged
Conversation
…#30) Closes #30. Before this change, every protocol's CMakeLists.txt added common/result.cc and common/util.cc into each binary's source list via file(GLOB), causing those two files to be compiled separately for every one of the 28 binaries. ccache was masking the duplication. The CI workflow's own comment was candid about it ("ccache deduplicates compilations across the 28 binaries... each protocol's CMakeLists.txt currently compiles common/*.cc and its own .cc files separately for every target"). Top-level CMakeLists.txt now: - Defines `ccbench_common` (STATIC) compiling common/{result,util}.cc once. PUBLIC link inheritance: Threads / Boost::filesystem / gflags / glog. PUBLIC include of the source root so ../include/foo.hh paths from the protocol dirs resolve through the library. - Defines imported targets `ccbench::masstree` and `ccbench::mimalloc` pointing at the bootstrap-built static archives in third_party/, so the raw paths stop being copy-pasted into every protocol. Each protocol's CMakeLists.txt now: - Drops `../common/result.cc` and `../common/util.cc` from its file(GLOB) blocks. - Replaces the per-binary `target_link_libraries(<bin> Boost::filesystem gflags::gflags <THIRD_PARTY_DIR>/mimalloc/...a <THIRD_PARTY_DIR>/ masstree/...a Threads::Threads)` block with a single foreach() that links each binary against ccbench_common + ccbench::masstree + ccbench::mimalloc PRIVATE. CRLF -> LF on the five CMakeLists.txt that had CRLF: silo/, ss2pl/, cicada/, mocc/, ermia/. Verified: - Build succeeds for all 34 binaries (Release, Debug+ASan). - common/result.cc.o and common/util.cc.o are now produced exactly once each per build directory (was 28 times). - Smoke runs of tpcc_<protocol>.exe across silo/mocc/cicada/ermia/ tictoc/oze/ss2pl/mvto/si all return non-zero throughput in Release. - Debug+ASan smoke of tpcc_silo (4t/4wh) and tpcc_si (4t/4wh) clean apart from the pre-existing MVCC version-leak in si/ermia (unrelated to this change). Out of scope (other Pn issues): - Per-protocol result.cc/util.cc still exist (P2 / #33). - add_definitions(...) blocks unchanged (P4 / #37). - cc_format/ untouched (P5 / #34). - oze/ still references THIRD_PARTY_DIR for googletest include (P8 / FetchContent territory in #37).
This was referenced May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #30.
What
Top-level
CMakeLists.txt:add_library(ccbench_common STATIC common/result.cc common/util.cc).PUBLIC link:
Threads / Boost::filesystem / gflags / glog.PUBLIC include: source root (so
../include/foo.hhresolves transitively).ccbench::masstreeandccbench::mimallocfor thebootstrap-built static archives — replaces the raw
\${THIRD_PARTY_DIR}/.../*.apaths.Each protocol's
CMakeLists.txt:"../common/result.cc"and"../common/util.cc"fromfile(GLOB).target_link_libraries(<bin> ... )blocks with asingle
foreach(t <bins...>) target_link_libraries(\${t} PRIVATE ccbench_common ccbench::masstree ccbench::mimalloc) endforeach().CRLF -> LF on
silo/ss2pl/cicada/mocc/ermia/CMakeLists.txt.Why
`common/result.cc` and `common/util.cc` were being recompiled separately for every one of the 28 binaries. ccache was masking the duplication; the CI workflow's own comment was candid about it.
Verified
Out of scope (tracked separately)
Diff highlights
```
CMakeLists.txt | +33
silo/CMakeLists.txt | -286 -> -100ish (similar pattern across 9 protocols)
11 files changed, +1027 -1247
```