-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NRVO does not occur with init procedures #19094
Labels
Comments
Simplified example I just ran into - this generates the following code which is .. quite bad (nim 1.2.14):
|
arnetheduck
added a commit
to status-im/nimbus-eth2
that referenced
this issue
Nov 15, 2021
These tools allow modifying an existing nimbus database for the purpose of recovery or reorg, moving the head, tail and genesis to arbitrary points. * remove potentially expensive `putState` in `BeaconStateDB` * introduce `latest_block_root` which computes the root of the latest applied block from the `latest_block_header` field (instead of passing it in separately) * avoid some unnecessary BeaconState copies during init * discover nim-lang/Nim#19094 * prefer `HashedBeaconState` in a few places to avoid recomputing state root * fetch latest block root from state when creating blocks * harden `get_beacon_proposer_index` against invalid slots and document * move random spec function tests to `test_spec.nim` * avoid unnecessary state root computation before block proposal
arnetheduck
added a commit
to status-im/nimbus-eth2
that referenced
this issue
Nov 18, 2021
* ncli_db: add putState, putBlock These tools allow modifying an existing nimbus database for the purpose of recovery or reorg, moving the head, tail and genesis to arbitrary points. * remove potentially expensive `putState` in `BeaconStateDB` * introduce `latest_block_root` which computes the root of the latest applied block from the `latest_block_header` field (instead of passing it in separately) * avoid some unnecessary BeaconState copies during init * discover nim-lang/Nim#19094 * prefer `HashedBeaconState` in a few places to avoid recomputing state root * fetch latest block root from state when creating blocks * harden `get_beacon_proposer_index` against invalid slots and document * move random spec function tests to `test_spec.nim` * avoid unnecessary state root computation before block proposal
ringabout
added a commit
to ringabout/Nim
that referenced
this issue
Jan 28, 2022
Araq
pushed a commit
that referenced
this issue
Jan 29, 2022
* [add testcase] NRVO does not occur with init procedures close #19094 * Update tests/ccgbugs2/tcodegen.nim
PMunch
pushed a commit
to PMunch/Nim
that referenced
this issue
Mar 28, 2022
* [add testcase] NRVO does not occur with init procedures close nim-lang#19094 * Update tests/ccgbugs2/tcodegen.nim
narimiran
pushed a commit
that referenced
this issue
Apr 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've read that using
result
guarantees NRVO to take place, so I was hoping that in the exampleinitX
andinitXInPlace
would be equivalent, resulting in no copying of typeX
resulting ininnerAddress
andouterAddress
staying the sameHowever it seems that doesn't happen, because test "NRVO1" fails while "NRVO2" succeeds
I added the
filler
field just to check if the object needed to be of a sufficient size, but no luck there eitherExample
Current Output
Expected Output
Possible Solution
Additional Information
Tested on the latest stable and development releases. Also tested on version 1.2.0 and 1.4.0 of the compiler, which also have the same issue.
The text was updated successfully, but these errors were encountered: