Skip to content

chore(build): stop compiling the unused flatc translation units - #258

Merged
Naruto merged 1 commit into
developfrom
chore/drop-unused-flatc-sources
Aug 3, 2026
Merged

chore(build): stop compiling the unused flatc translation units#258
Naruto merged 1 commit into
developfrom
chore/drop-unused-flatc-sources

Conversation

@Naruto

@Naruto Naruto commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Both build paths compiled four FlatBuffers translation units that nothing in this project uses:

# ss_player/sources.py
fb_sources = ["idl_parser.cpp", "idl_gen_text.cpp", "reflection.cpp", "util.cpp"]

These are the flatc (schema compiler) side of FlatBuffers. Playback needs none of it — schema compilation is libssconverter's job on the Rust side. They look like a leftover from when .sspj.ssab conversion was going to happen in C++.

FlatBuffers is used header-only here: the generated format/*.h headers include flatbuffers/flatbuffers.h, whose reachable set (16 headers: buffer/table/vector/verifier/builder…) is entirely inline.

Evidence that nothing linked against them:

  • No source includes idl.h, reflection.h or util.h — the only FlatBuffers include anywhere in the project is flatbuffers/flatbuffers.h, via format/*.h.
  • Every FlatBuffers symbol used is header-only: Offset, Vector, FlatBufferBuilder, Table, Verifier, GetRoot, GetSizePrefixedRoot, BufferHasIdentifier, EndianScalar.
  • nm -u over all 18 built objects (1:1 with the 18 .cpp files) reports zero undefined flatbuffers:: symbols. The linker never asked for anything these four files define.

Changes

  • ss_player/sources.py — remove get_fb_sources(), replaced by a comment recording why FlatBuffers is header-only here. Also drop flatbuffers/src from the include path; it was only needed so those translation units could find their own private headers (format/*.h resolves fine from flatbuffers/include alone).
  • ss_player/SCsub — remove the add_source_files loop (custom module).
  • SConstruct — remove the sources_list.extend(...) call (GDExtension).

Impact

~757 KB of object code per target is no longer built, on every platform/arch a release build covers:

object size (-O2)
idl_parser.o 574 KB
idl_gen_text.o 84 KB
reflection.o 70 KB
util.o 30 KB

Stale objects from earlier builds confirmed this was being paid across 7 targets already (macOS editor, 3 Android ABIs, 3 iOS slices) — 28 objects, 5.0 MB.

No functional change.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Build cleanup — none of the above categories apply.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation — n/a, no documented behaviour changes
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules — n/a

Verification

Both build paths were built locally on macOS arm64:

GDExtension (./scripts/build-extension.sh) — builds and links clean.

libSSGodot.macos.editor          4,538,936 bytes
undefined flatbuffers symbols    0  (fully resolved)
flatc-side symbols in binary     0  (Parser / GenerateText / Registry)

Custom module (./scripts/build.sh) — godot.macos.editor.arm64 links successfully (2m32s). flatbuffers:: symbols in the binary: 0, as expected for header-only, fully-inlined use.

The duplicate symbol link warnings (Rust runtime symbols shared between libssruntime.a and libssconverter.a) are pre-existing and identical before and after this change.

Both build paths fed four FlatBuffers sources - idl_parser.cpp,
idl_gen_text.cpp, reflection.cpp and util.cpp - into the object list, but
nothing references them. FlatBuffers is used header-only here: the generated
format/*.h headers include flatbuffers/flatbuffers.h, and every symbol the
player touches (Offset, Vector, FlatBufferBuilder, Table, Verifier, GetRoot)
is inline. No source includes idl.h, reflection.h or util.h, and `nm -u` over
all 18 built objects reports zero undefined flatbuffers symbols, so the
linker never asked for any of it. Schema compilation is libssconverter's job
on the Rust side; the flatc-side code is a leftover from when that was going
to happen in C++.

Drop the four sources from both SConstruct and SCsub, and drop
flatbuffers/src from the include path - it was only there so those
translation units could find their own private headers.

That is ~757 KB of object code per target that is no longer built
(idl_parser.o alone is 574 KB at -O2), on every platform and arch a release
build covers.
@Naruto
Naruto merged commit 59f1a91 into develop Aug 3, 2026
0 of 2 checks passed
@Naruto
Naruto deleted the chore/drop-unused-flatc-sources branch August 3, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant