refactor: encapsulation cleanup (send/respond_to?) and complete performance TODOs#694
Open
ronaldtse wants to merge 1 commit into
Open
refactor: encapsulation cleanup (send/respond_to?) and complete performance TODOs#694ronaldtse wants to merge 1 commit into
ronaldtse wants to merge 1 commit into
Conversation
…e performance TODOs Encapsulation cleanup: - Replace all send() calls with public_send() to respect method visibility - Replace respond_to? with explicit is_a? type checks for proper typing - Remove instance_variable_get on external objects where found - Update test doubles to use proper Namespace subclasses Performance optimizations (verified from TODO.remaining-perf): - 01: Truly lazy namespace collection (store element ref instead of eager walk) - 02: Short-circuit UninitializedClass in XML path (key_value path unchanged) - 03: Replace respond_to? with type hierarchy in hot path - 04: Thread resolved type through call chain, cache resolver in Attribute - 05: Replace Mutex with Concurrent::Map in TransformationRegistry - 06: Reduce GC pressure (cache prefixed names, avoid unnecessary allocations) - 07: Eliminate repeated is_a?(Serialize) checks with instance flag PI Phase 1 (verified from TODO.pi-phase1): - Multi-adapter roundtrip tests verified - Hash attribute default nil handling verified - Documentation verified - Items 3 (value_map for PIs) and 4 (inline PIs) correctly deferred All 4931 tests pass, 0 failures.
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
This PR completes two major workstreams:
1. Encapsulation Cleanup
send()→public_send(): All dynamic dispatch now respects method visibilityrespond_to?→is_a?: Type checks use explicit type comparison instead of duck typingLutaml::Xml::Namespacefor proper type checkingrespond_to?kept where method is dynamically added (e.g.,element_orderon non-Serialize models)2. Performance TODOs (all verified and removed)
TODO.remaining-perf (7 items — all verified DONE):
newwith different nil semantics)respond_to?with type hierarchy — removed redundantis_a?(XmlElement)checks on childrenConcurrent::Mapfor@mappings(notcompute_if_absentdue to recursive deadlock risk)options.except/mergeallocationsinstance_is_serializeflag instead of checkingis_a?(Serialize)8+ times per elementTODO.pi-phase1 (6 items — 4 verified DONE, 2 correctly deferred):
Test Results
Files Changed