Repository navigation
perf(parsing): add DirectStructParser bypassing NamedTuple/Tuple for plain aggregates - #124
Open
clockblocker wants to merge 3 commits into
Open
clockblocker wants to merge 3 commits into
clockblocker wants to merge 3 commits into
Conversation
…Collector, found_count fast path, noexcept read_with_default, deduplicated readers, expanded tests)
…ay partial-destruction test)
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.
Summary
Stacked on
#118(perf-parser-symbol-isolation) ->#119(feat-rfl-metadata).Adds Tier 2
DirectStructParser(include/rfl/parsing/DirectStructParser.hpp) + value-levelDirectFieldNames<T>(include/rfl/internal/DirectFieldNames.hpp) so eligible plain aggregate structs bypassrfl::NamedTuple<Field<Literal<...>, T>...>,rfl::Tuple<...>,rfl::ViewReader*, andNamedTupleParsercompletely duringread,write, andto_schema— with zero public API changes.Key Architectural Changes
DirectFieldNames<T>): Extracts field names directly viainternal::get_field_names<T>into a compact constexpr string buffer +std::array<std::string_view, N>(norfl::Literal<...>type lists orrfl::Field<...>wrapper packs).internal::apply_to_fields+FieldAddrCollector): Binds struct members viastd::addressofinto a flatvoid*/const void*pointer array without instantiatingrfl::Tuple<Field0*, ..., FieldN-1*>or variadic generic lambdas.DirectFieldDesc): One tinyDirectStructParserdescriptor table per struct with non-T, non-Nruntime drivers (DirectStructViewReader,run_direct_read,run_direct_write,run_direct_to_schema,DirectDestroyGuard).can_use_direct_struct_parser_v<T, ProcessorsType, R>): Activates for plain aggregates with identity/builtin processors (excludingFlatten,ExtraFields, non-identity name-transform/custom processors,rfl::env::Reader, and schemaful/positional readers that require staticViewType::size()oris_view_reader_v). Preservesrfl::DefaultVal,rfl::Skip,rfl::Rename,rfl::Attribute,rfl::Validator,rfl::Metadata<T>,DefaultIfMissing,NoExtraFields,NoOptionals,NoFieldNames,AllOf/FailFast,constfields, move-only types, and C-arrays (REFLECT_CPP_C_ARRAYS_OR_INHERITANCE).Benchmarks (AppleClang 17 arm64, uncontended CPU)
1. Real-World Production Guinea Pig: upstream
slang-server(1b413a4,-O2 -g, no PCH, zero source changes)#118+#119-> Tier 2).oSize__textNamedTupleSymsSlangServer.cppConfig.cppgen_config_main.cppgen_config_schemaJSON output parity: 8,904 bytes vs 8,904 bytes (100% byte-identical).2. Synthetic 48-Field
ConfigDataBenchmark (bench_48_*, stacked on#118+#119)#118+#119-> Tier 2).oSizeNamedTupleSymsbench_48_plain(-O0 -g)#11819.12 MiB: -84.3%)bench_48_metadata(-O0 -g)bench_48_desc(-O0 -g)#118148.71 MiB: -92.4% / 13.1x)bench_48_plain(-O2 -g)bench_48_metadata(-O2 -g)bench_48_desc(-O2 -g)bench_48_plain, 50k iters,-O2):read97.6-98.7ms vs 105.0-106.2ms (~1.3 ns/field for indirect dispatch);read_default100.9-103.2ms vs 102.7-104.6ms;write60.4-61.4ms vs 65.5-66.7ms.Verification
-std=gnu++20 -Wall -Wextra -Werror(Parser_default.hppwith-Wall -Werror).REFLECTCPP_STRICT_WARNINGS=ON): 401/401 targets, 0 warnings.json,json_c_arrays_and_inheritance,generic,cli,env,xml): 680/680 passed (100%).-fsanitize=undefined -fno-sanitize-recover=all):test_direct_struct_parser(6/6) andtest_direct_struct_c_arrays(1/1, includingstd::string[2]partial-construction cleanup) pass cleanly.REQUEST CHANGES-> all 7 blockers and 11 nits resolved) and Round 2 (APPROVE WITH NITSfrom both Correctness/UB and Architecture/Perf Judges; remaining non-blocking nits also polished).