Skip to content

build: remove code nothing links; stop sed-patching fc's CMake in CI - #227

Merged
On1x merged 1 commit into
masterfrom
build/drop-dead-code
Nov 1, 2026
Merged

On1x merged 1 commit into
masterfrom
build/drop-dead-code

Conversation

@chiliec

@chiliec chiliec commented Nov 1, 2026

Copy link
Copy Markdown
Member

Second pass after #213: find code that is compiled but never linked, using the linker itself rather than grep.

Method. Relink all 23 executables (vizd, cli_wallet, 14 ctest binaries, util tools, appbase_example, chainbase_test) with -Wl,-map, collect which static-archive members each one loads, diff against ar t. A member no binary loads, whose header no live file includes, is dead. Cross-checked with an nm symbol-reference graph.

Removed here

  • libraries/api: discussion_helper.{hpp,cpp}, content_api_object.{hpp,cpp}, discussion.hpp, vote_state.hpp, account_vote.hpp — Steem discussion-API leftovers, included only by each other.
  • libraries/chain/chain_objects.cpp — 121 lines, all commented out.
  • libraries/utilities: string_escape, tempdir, padding_ostream.hpp — no includer.
  • wallet.hpp: stale <fc/real128.hpp> include. wallet/CMakeLists.txt: an add_custom_command whose output no target consumed.
  • Workflows: the five sed -i '/add_subdirectory(tests)/d' thirdparty/fc/CMakeLists.txt lines, now that fc defaults BUILD_FC_TESTS to OFF.

Removed in fc (VIZ-Blockchain/fc#5, submodule bumped): 17 modules + the cyoencode vendor lib + src/ssh/pke that were never built. Table and rationale in that PR. Merge fc#5 first.

Honest numbers

CPU-s share of full build (~43 CPU-min)
dead fc TUs (23) 32 1.2 %
dead VIZ TUs (5) 34 1.3 %
appbase_example + chainbase_test (left alone, only built by make all, not by Docker/CI) 13 0.5 %

This is cleanup, not a speedup. Everything else in the tree is loaded by some binary. The build time lives in the top five TUs (database.cpp 248 s, wallet.cpp 162 s, dlt_p2p_node.cpp 130 s, operations.cpp 127 s, snapshot/plugin.cpp 102 s) and is optimizer time on fc::raw visitor instantiations, as profiled in #213. Cutting that means explicit instantiation of the block/operation serializers or splitting database.cpp, which is a different PR.

Verification

  • Full native build on Apple Silicon: vizd, cli_wallet, all 14 test binaries, util tools link. 13/13 fast ctest pass. consensus_sim runs in CI.
  • Labels check-arm64 + check-boost-range added so the distro-Boost 1.83 and arm64 jobs exercise the fc CMake change.

Linker maps of all 23 executables (vizd, cli_wallet, every ctest binary, the
util tools) show these objects are never loaded and their headers have no
includer outside the dead set:

  libraries/api: discussion_helper, content_api_object, discussion.hpp,
                 vote_state.hpp, account_vote.hpp  (Steem discussion API leftovers)
  libraries/chain: chain_objects.cpp               (entirely commented out)
  libraries/utilities: string_escape, tempdir, padding_ostream.hpp

wallet.hpp drops its stale <fc/real128.hpp> include; the wallet CMake drops an
add_custom_command whose output nothing consumed.

fc submodule -> fc#5, which removes the libfc.a members nothing links and
defaults BUILD_FC_TESTS to OFF, so the five `sed -i '/add_subdirectory(tests)/d'`
lines in the workflows go away.

Measured: the removed TUs are ~85 CPU-s of a ~43 CPU-min full build. Cleanup,
not a speedup; the real cost stays in database.cpp / wallet.cpp codegen.
@chiliec chiliec added check-boost-range Also run the distro Boost 1.83 range-floor build check-arm64 Run the label-gated arm64 build (ubuntu-24.04-arm) on this PR labels Nov 1, 2026
@On1x
On1x merged commit ee1b7d6 into master Nov 1, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

check-arm64 Run the label-gated arm64 build (ubuntu-24.04-arm) on this PR check-boost-range Also run the distro Boost 1.83 range-floor build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants