Repository navigation
perf(parsing): peel transparent metadata wrappers before Parser read, write, and to_schema - #260
Open
clockblocker wants to merge 1 commit into
Conversation
… write, and to_schema
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.
Problem
Every distinct string literal inside
rfl::Description<"...", T>,rfl::Deprecated<"...", "...", T>,rfl::Rename<"...", T>, orrfl::Short<"...", T>creates a unique C++ type.ViewReader,ViewReaderWithDefault, andNamedTupleParserpass that still-wrapped type straight intoParser<R, W, WrappedT, ProcessorsType>::{read, write, to_schema}, multiplying full parser,rfl::Result<WrappedT>, and schema template instantiations across every documented or renamed field—and baking the description strings into mangled symbols and DWARF debug info.N=3strictly interleaved vs.23146188, Linux Clang 23.1.6 & GCC 13.4.0,ccacheoff — refl-cpp-workbench#45):openmoq/moqx(184wrapper sites):Loader.cpp.o-23.2% (6.51 → 5.00 MB), wall -12.7%, peak RSS -11.0%; full cold project build -6.8% (328.7 → 306.5 s, total.o-1.4 MiB).hudson-trading/slang-server(29wrapper sites, PCH-free):Config.cpp.o-20.7% (994 → 788 KB),.text-17.5%, wall -16.5%, wrapper-named symbols -53.1% (207 → 97).read+DefaultIfMissing+write+to_schema):.o-44.0%,.text-51.1%, wrapper symbols -66.2%.-O0 -g): wall -36.2%, RSS -11.0%,.o-9.3% (-10.5 MB),.text-36.4%..o-40.2%,.text-52.4%, wrapper symbols -67.5%.Summary
include/rfl/parsing/peel_transparent_wrappers.hppto recursively peelrfl::Description,rfl::Deprecated,rfl::Rename, andrfl::Shortat compile time while stopping at semantic boundaries (rfl::DefaultVal,rfl::Skip,rfl::Attribute,rfl::ExtraFields,rfl::Validator, raw pointers, C-arrays, references,const/volatileinner types,rfl::Reflector<Outer>, andR::has_custom_constructor<Outer>).ViewReader,ViewReaderWithDefault, andNamedTupleParser(read, write, andto_schema) with zero parallel engine, zero public API change, and MSVC/W4 /WX(C4714/C4100/C4127) + Clang 15constexprguards.rfl::parsing::Parserdirectly onDescription/Deprecated/Rename/Short(publicrfl::Reflector<Outer>andR::has_custom_constructor<Outer>remain respected).openmoq/moqxsrc/config/Loader.cpp184Description/Deprecated/Renameconfig sites caused6.51 MBLoader.cpp.o(-23.2%.o, -12.7% wall after peeling).hudson-trading/slang-serverinclude/Config.h#L35-L17029documented/deprecated server config fields multipliedParsersymbols (-20.7%.o, -16.5% wall, -53.1% wrapper symbols).For Agents
upstream-queue(0bca6f0f) · Score82/100(S=21,M=25,D=24,R=12) ·+495/-26(4f)#228,#257queue-tests/json/test_peel_transparent_wrappers.cppCHECK_HEADERS24/24PASS (-Wall -Wextra -Wextra-semi -Wsign-conversion -Wpedantic -Werror, Clang 23 & GCC 13 across C++20/23 & C-arrays);queue-tests/234/234PASS across all 12 formats on Clang 23 & GCC 13; ASan+UBSan5/5PASS (0errors/leaks); upstream CI673/673PASS (Clang 23 JSON+YAML,0warnings).refl-cpp-workbench#45,N=3interleaved):moqxLoader.cpp-23.2%.o/-12.7%wall /-11.0%RSS (-6.8%full build);slang-serverConfig.cpp-20.7%.o/-17.5%.text/-16.5%wall /-53.1%wrapper symbols; 64-field wrapped stress-44.0%.o&-51.1%.text(Clang 23),-52.4%.text(GCC 13),-36.2%wall &-10.5 MB.o(Clang 23 Debug).RFL_PEEL_ALWAYS_INLINE(inlineon MSVC,RFL_ALWAYS_INLINEon GCC/Clang) to prevent MSVC/W4 /WXC4714, suppresses discarded-branchC4100, guardsschema_meta_count > 0(nostd::array<..., 0>/C4127), and usesconstexpr+static constexpr.rodatafor older Clang compatibility.