Repository navigation
Emit selected unary assignment methods without temporary expression trees - #660
Open
jogibear9988 wants to merge 1 commit into
Open
jogibear9988 wants to merge 1 commit into
jogibear9988 wants to merge 1 commit into
Conversation
Increment/decrement assignment with an operator method builds temporary assignment/block expression nodes during compilation even for an ordinary parameter or local variable. Load the value, call the selected method, store the assignment and preserve the required pre/post result directly. Retain the existing lowering for captured/ref storage, lifted nullable calls, intrinsic operands and complex targets. Validation: Release solution build and full Standard/LightExpression runners on .NET 8, .NET 10 and .NET Framework. Pre/post increment and decrement, locals and parameters, selected methods, discarded results, value-type results used as receivers, lifted/nonlifted nullable methods, and existing ref/captured storage behavior.
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.
Increment/decrement assignment with an operator method builds temporary assignment/block expression nodes during compilation even for an ordinary parameter or local variable.
Load the value, call the selected method, store the assignment and preserve the required pre/post result directly. Retain the existing lowering for captured/ref storage, lifted nullable calls, intrinsic operands and complex targets.
Pre/post increment and decrement, locals and parameters, selected methods, discarded results, value-type results used as receivers, lifted/nonlifted nullable methods, and existing ref/captured storage behavior.
Validation: Release solution build; full Standard and LightExpression runners on .NET 8, .NET 10 and .NET Framework. net8.0: 565 TestX cases and 1744 legacy cases; net10.0: 565 TestX cases and 1745 legacy cases; net472: 546 TestX cases and 1610 legacy cases.
Shared-workload measurements
Base:
bac81d0734c0(master); patch:36cea7097a41. Windows ARM64, SDK 10.0.301; .NET 8.0.28 and 10.0.9. Expression trees and invocation adapters are prepared outside the timed loops. Strict FEC compilation, tiered compilation disabled, one pinned logical processor, two opposite-load-order processes per runtime, seven alternating paired samples per process, 30 ms calibration target; medians of 14 samples.Both columns below are FEC. “System trees” names the expression API, not the System compiler. Compilation includes delegate creation; invocation measures the returned delegate through the same adapter on each side. Managed allocations use GC.GetAllocatedBytesForCurrentThread.
custom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_addEmitted IL matched byte-for-byte for 20/20 shared control delegates. Observed compilation changes range from -30.3% to +7.1%; invocation changes from -6.9% to +22.8%. Slower results are retained. Even identical-IL controls vary, so these short machine timings do not establish a blanket runtime speedup or absence of regressions.
Managed allocation changes: net8.0/Standard/custom_increment/compile: 1040.16 → 928.16 B/op; net8.0/Standard/custom_decrement/compile: 1040.16 → 928.16 B/op; net8.0/Light/custom_increment/compile: 1040.00 → 928.00 B/op; net8.0/Light/custom_decrement/compile: 1040.00 → 928.00 B/op; net10.0/Standard/custom_increment/compile: 1040.16 → 928.16 B/op; net10.0/Standard/custom_decrement/compile: 1040.16 → 928.16 B/op; net10.0/Light/custom_increment/compile: 1040.00 → 928.00 B/op; net10.0/Light/custom_decrement/compile: 1040.00 → 928.00 B/op.
Longer confirmation run
Same base, patch and paired protocol, with a 150 ms calibration target instead of 30 ms. These results are additional measurements of the same code; they do not replace slower observations above.
custom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_addcustom_decrementcustom_incrementdecimal_addref_compoundscalar_add