You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Profile and root-cause 101 MiB Debug object-file and compile-time explosion on wrapper-annotated structs #90
What exact template instantiations, symbol/DWARF emissions, and reflect-cpp metaprogramming paths cause a 48-field wrapper-annotated struct to explode into a 101 MiB Debug .o file and ~35s compile time, and where are the highest-leverage levers to cut both by an order of magnitude?
ccache#2:config.cpp.o = 106.25 MB (~101 MiB) and ~35s Debug compile on 48-field ConfigData annotated with rfl::Description<StringLiteral, ...>.
cppcheck#3: 37-field ProjectFileSchema compiled across 5 pipelines.
osmium-tool#3: 20–30 CPU-s/TU across 23 subcommand TUs.
Execution Notes
Hold timing runs until heavy local builds clear so -ftime-trace and wall-clock measurements are not skewed by CPU/IO contention.
Produce concrete -ftime-trace flamegraph breakdowns, nm/bloaty/DWARF section attributions on ccache#2config.cpp.o, and a ranked list of root causes (e.g., StringLiteral NTTP mangling length, nested wrapper tuple/visitor instantiation depth, DWARF debug-info duplication) to unblock the Lane 1 zero-bloat prototype ticket.
Large plain reflected structs in transmission/libtransmission/rpc-schema.h — TorrentInfo (81 fields) and SessionSetParams (53 fields) — incur ~25–59s user compile time per RPC TU on AppleClang arm64 RelWithDebInfo.
This confirms the compile-time cliff reproduces even in RelWithDebInfo on large 50–80+ field structs (not only wrapper-heavy Debug builds), directly validating upstream #799 / Wave 10 #61. Include transmission/libtransmission/rpc-schema.h in -ftime-trace profiling alongside ccache#2config.cpp.o.
Recipient update:ccache has been retired as a Showcase Migration recipient (fork being deleted). Reproduce the 48-field rfl::Description<StringLiteral, DefaultVal<T>> 101 MiB Debug .o cliff using a self-contained in-repo repro under reflect-cpp/bench/, paired with real-world measurements from transmission#1 (81-field TorrentInfo / 53-field SessionSetParams), osmium-tool#3, and slang-server.
bin/gen_config_schema: 1.38 MiB (1,446,752 B) → 1.70 MiB (1,781,456 B) (+335 KB / +23.1%) even after deleting addDefaults/rfl::Generic, driven by per-field to_generic instantiation across $defs under to_schema<T, rfl::DefaultIfMissing>.
Prioritize profiling SlangServer.cpp.o, reflectcpp_json.cpp.o, and gen_config_schema alongside ccache#2 / transmission#1 since slang-server is an active regression harness.
Completed -ftime-trace, Mach-O size -m, and nm symbol profiling on a quiet AppleClang 17 arm64 host against showcase/all-lanes (49f044ec). Unblocks #91.
Long StringLiteral<N> NTTP mangling baked into field types (rfl::Description<"...", DefaultVal<T>>) — 7.8× Debug .o bloat (129.6 MiB) & 2.1× compile time: Every byte of prose mangles as a separate decimal char literal (~4–5× expansion) inside NamedTuple<48 fields>, creating 43 KB mangled names repeated across thousands of symbols (97.8% of .o is __debug_str + symbol table; only 0.4% is __text). Lever: Out-of-band zero-bloat metadata specialization (rfl::Metadata<T>) keeping prose completely out of field C++ types.
Per-field member function templates on NamedTupleParser<..., 48 fields> and ViewReader<..., 48 fields> (and linear fold-expression dispatch in ViewReader) — drives BOTH bench_48_plain (19.1 MiB) and SlangServer.cpp (39.4s / 60.6 MiB):add_field_to_object<0..N-1>, add_field_to_schema<0..N-1>, handle_one_missing_field<0..N-1>, and ViewReader::assign_if_field_matches<0..N-1> each repeat the full NamedTuple mangled type, and ViewReader's inline fold expression hammers LLVM's ModuleInlinerWrapperPass (9.73s on SlangServer.cpp). Lever: Move per-field work to non-nested free helpers parameterized only by (R, W, CoreType, ProcessorsType) and give ViewReader sorted binary-search table dispatch.
Linear $O(N^2)$CountFieldsHelper::count_max_args_in_agg_init (num_fields.hpp:109-117) — 7.62s (1,817×) in SlangServer.cpp & 1.30s in bench_48_desc: Scans n = 0, 1, 2, ..., N one by one instead of exponential + binary search once constructible<lo>() succeeds (which holds at lo = 0 for almost all structs).
Per-field rfl::to_generic<ProcessorsType> instantiation in NamedTupleParser::add_field_to_schema under DefaultIfMissing — +23.1% gen_config_schema binary bloat (29× instantiations): Fast-pathing basic scalars directly to rfl::Generic(...) avoids instantiating generic::Writer per scalar field.
Dead ViewReader instantiation in read_struct_with_default (Parser_default.hpp:1170) when DefaultVal is wrapped in Description: Adds 1.41s + 3.92 MiB of dead ViewReader symbols to bench_48_desc.
Activity
clockblocker commentedon Nov 27, 2026
Additional Showcase Evidence (
clockblocker/transmission#1,6478ae0d0):transmission/libtransmission/rpc-schema.h—TorrentInfo(81 fields) andSessionSetParams(53 fields) — incur ~25–59s user compile time per RPC TU on AppleClang arm64RelWithDebInfo.RelWithDebInfoon large 50–80+ field structs (not only wrapper-heavy Debug builds), directly validating upstream#799/ Wave 10#61. Includetransmission/libtransmission/rpc-schema.hin-ftime-traceprofiling alongsideccache#2config.cpp.o.clockblocker commentedon Nov 27, 2026
Recipient update:
ccachehas been retired as a Showcase Migration recipient (fork being deleted). Reproduce the 48-fieldrfl::Description<StringLiteral, DefaultVal<T>>101 MiB Debug.ocliff using a self-contained in-repo repro underreflect-cpp/bench/, paired with real-world measurements fromtransmission#1(81-fieldTorrentInfo/ 53-fieldSessionSetParams),osmium-tool#3, andslang-server.clockblocker commentedon Nov 27, 2026
Active Regression Harness Evidence (clockblocker/slang-server#1,
bf857f4—all-planned-prs7a8ab835vs upstreama26047a, AppleClang 17 arm64RelWithDebInfo):all-planned-prs:slang_server_obj_lib(41 TUs CPU sum):389.25s → 599.47s(base) /590.76s(final, +51.8%)SlangServer.cpp.o:121.18s → 217.09s(base) /177.60s(afterrfl::json::Raw, +46.6%)reflectcpp_json.cpp.o:19.38s → 30.18s(base) /32.00s(final, +65.1%)src/gen_config_main.cpp:16-18):bin/gen_config_schema:1.38 MiB (1,446,752 B) → 1.70 MiB (1,781,456 B)(+335 KB / +23.1%) even after deletingaddDefaults/rfl::Generic, driven by per-fieldto_genericinstantiation across$defsunderto_schema<T, rfl::DefaultIfMissing>.bin/slang-serveritself shrank14.65 MiB → 13.91 MiB/ −5.06%.)SlangServer.cpp.o,reflectcpp_json.cpp.o, andgen_config_schemaalongsideccache#2/transmission#1sinceslang-serveris an active regression harness.clockblocker commentedon Nov 27, 2026
Completed
-ftime-trace, Mach-Osize -m, andnmsymbol profiling on a quiet AppleClang 17 arm64 host againstshowcase/all-lanes(49f044ec). Unblocks#91.1. Self-Contained 48-Field
ConfigDataRepro (rfl::Description<StringLiteral, DefaultVal<T>>vs Plain +DefaultIfMissing)read+write+to_schema).oSize__DWARF,__debug_strsum(len(mangled))__TEXT,__textbench_48_desc(Description<StringLiteral, DefaultVal<T>>)-O0 -g)bench_48_plain(plain fields +DefaultIfMissing)-O0 -g)bench_48_desc(Description<StringLiteral, DefaultVal<T>>)-O2 -g)bench_48_plain(plain fields +DefaultIfMissing)-O2 -g)Mangled symbol breakdown on
bench_48_descDebug (8,754 symbols, 62.77 MiB):Tuple: 17.39 MiB (802 syms)NamedTupleParser: 14.03 MiB (357 syms)NamedTuple: 13.66 MiB (357 syms)Parser: 12.00 MiB (646 syms)ViewReader: 3.92 MiB (102 syms — dead instantiation!)ViewReaderWithDefault: 2.34 MiB (61 syms)2. Active Regression Harness:
slang-server(RelWithDebInfo -O2 -g,showcase/all-lanes).oSize__debug_str__text-ftime-traceHotspotsSlangServer.cppViewReader40.57s (973x),NamedTupleParser39.82s (1302x),Parser38.85s (1312x),ModuleInlinerWrapperPass9.73s,CountFieldsHelper7.62s (1817x)reflectcpp_json.cppParser10.51s,NamedTupleParser4.54s,Variant4.12s,ModuleInlinerWrapperPass2.67sConfig.cppParser2.66s,ViewReaderWithDefault2.20s (312x),NamedTupleParser2.02sgen_config_main.cppParser3.66s,NamedTupleParser1.83s,to_generic/generic::write29x instantiations across$defs3. Ranked Root Causes & Levers for
#91StringLiteral<N>NTTP mangling baked into field types (rfl::Description<"...", DefaultVal<T>>) — 7.8× Debug.obloat (129.6 MiB) & 2.1× compile time: Every byte of prose mangles as a separate decimal char literal (~4–5×expansion) insideNamedTuple<48 fields>, creating 43 KB mangled names repeated across thousands of symbols (97.8%of.ois__debug_str+ symbol table; only0.4%is__text). Lever: Out-of-band zero-bloat metadata specialization (rfl::Metadata<T>) keeping prose completely out of field C++ types.NamedTupleParser<..., 48 fields>andViewReader<..., 48 fields>(and linear fold-expression dispatch inViewReader) — drives BOTHbench_48_plain(19.1 MiB) andSlangServer.cpp(39.4s / 60.6 MiB):add_field_to_object<0..N-1>,add_field_to_schema<0..N-1>,handle_one_missing_field<0..N-1>, andViewReader::assign_if_field_matches<0..N-1>each repeat the fullNamedTuplemangled type, andViewReader's inline fold expression hammers LLVM'sModuleInlinerWrapperPass(9.73s onSlangServer.cpp). Lever: Move per-field work to non-nested free helpers parameterized only by(R, W, CoreType, ProcessorsType)and giveViewReadersorted binary-search table dispatch.CountFieldsHelper::count_max_args_in_agg_init(num_fields.hpp:109-117) — 7.62s (1,817×) inSlangServer.cpp& 1.30s inbench_48_desc: Scansn = 0, 1, 2, ..., None by one instead of exponential + binary search onceconstructible<lo>()succeeds (which holds atlo = 0for almost all structs).rfl::to_generic<ProcessorsType>instantiation inNamedTupleParser::add_field_to_schemaunderDefaultIfMissing— +23.1%gen_config_schemabinary bloat (29× instantiations): Fast-pathing basic scalars directly torfl::Generic(...)avoids instantiatinggeneric::Writerper scalar field.ViewReaderinstantiation inread_struct_with_default(Parser_default.hpp:1170) whenDefaultValis wrapped inDescription: Adds 1.41s + 3.92 MiB of deadViewReadersymbols tobench_48_desc.