fix: unnecessary continuation after finding mutation#28430
fix: unnecessary continuation after finding mutation#28430120c0 wants to merge 1 commit intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
mzumsande
left a comment
There was a problem hiding this comment.
#22046 was a similar PR, just want to link to that discussion. This PR seems equivalent to "Tweak 1" from #22046 (review).
luke-jr
left a comment
There was a problem hiding this comment.
crACK, though I wonder if it actually makes a noteworthy improvement?
|
I tend to be concept NACK: unless I'm missing something, this does not improve performance in a meaningful way
|
|
Thanks for the PR, however we are going to leave this as-is for now. If you're interested in contributing, you can also checkout the "Good first issue" label. |
I think this will come up again in the future, so it would probably make sense to add a comment why |
|
Also, a test would be good that fails on the changes in this pull request. |
I don’t think that’s right. The break only exits the loop that sets |
Oh, you are right, I misread the code. For some reason I thought the break would refer to the |
|
I retreat the NACK, though I'm still skeptical if we should change this kind of code without a measurable performance benefit. |
Github-Pull: bitcoin#28430 Rebased-From: 42b25bb
A simple increment so that when the mutation is successfully found, the break already exits the for to avoid an unnecessary continuation.
The concept is simple, this change should improve the performance of this function, providing a faster completion when meeting the given objective.