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
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
mof_construct is the only that changed more than results variation, it shows some improvement due to doing less work.
mof_construct_and_move addresses the concern of potential slowdown due to failed store-to-load forwarding.
The concern was due to storing zero as one pointer but then loading two pointers, which can be loaded in the same vector register. If the load happens shortly after the store, it has to wait for the store to completely reach the cache, as the wider value cannot be obtained from the narrower store buffer entry.
The situation apparently does not happen, as before the actual two-pointers move, there's vtable obtaining and inspection, which takes enough time for the store to complete.
mof_none and mof_move give some idea on the corresponding baseline timings. They are not expected to change.
On my 5950X I actually observe mof_construct_and_move becoming slower:
Benchmark
Before
After
Speedup
mof_none
1.46 ns
1.26 ns
1.16
mof_construct
1.91 ns
1.48 ns
1.29
mof_move
4.21 ns
4.18 ns
1.01
mof_construct_and_move
3.38 ns
7.25 ns
0.47
However, this case seems unrealistic (how often are users default-constructing and immediately moving), and if the code had originally been written this way, I would never have asked for an additional pointer to be nulled.
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.
Primarily I treat this more as a clarity improvement.
Yet, the benchmark results prove this PR deserving
performance
label.Resolves #5316
⏱️ Benchmark results
🥇 Results interpretation
mof_construct
is the only that changed more than results variation, it shows some improvement due to doing less work.mof_construct_and_move
addresses the concern of potential slowdown due to failed store-to-load forwarding.The concern was due to storing zero as one pointer but then loading two pointers, which can be loaded in the same vector register. If the load happens shortly after the store, it has to wait for the store to completely reach the cache, as the wider value cannot be obtained from the narrower store buffer entry.
The situation apparently does not happen, as before the actual two-pointers move, there's vtable obtaining and inspection, which takes enough time for the store to complete.
mof_none
andmof_move
give some idea on the corresponding baseline timings. They are not expected to change.