Repository navigation
Conversation
davidrohr
reviewed
Oct 12, 2026
davidrohr
left a comment
Collaborator
There was a problem hiding this comment.
Hm, I don't like that we need more instructions, but I do not think that there is a better solution. I do not believe this is performance critical, but I want to check at least that it does not change the performance. An alternative to make the code cleaner could be to use a lambda or a separate function.
Collaborator
|
I will try to run with this and O2/dev today and compare the performance on GPU, but I do not think there will be a difference. If we could have a version with a lambda or a function and return instead of goto, I'd prefer that for the syntax, and I assume also that would not change the performance. |
MSL supports neither goto nor labels. The label sat at the end of the loop body, so each jump was a continue for the outer loop that could not be written as one because it was issued from an inner loop. Two lambdas take over the chain walks that did the jumping: one advances a track along its segment chain and reports whether the target was met on the way, the other reports whether the target sits on either neighbour chain. Each jump then becomes a plain continue at the top level of the loop body. A null target lets the first one also cover the four walks that never tested for one, leaving the file three lines shorter than it is with the goto. Checked against the goto version by transcribing both loop bodies into a harness and comparing the skip decision and the resulting segment and neighbour links of every track over 400000 random link graphs, 71% of which took a skip path and 100000 of which reached the merging stage: no differences.
Member
Author
|
Version with the lambda now pushed in place of the old commit. It's even 3 lines shorter... ;-) |
This branch has not been deployed
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.
MSL supports neither goto nor labels. The label sat at the end of the loop body,
so each jump was a continue for the outer loop that could not be written as one
because it was issued from an inner loop.
Two lambdas take over the chain walks that did the jumping: one advances a track
along its segment chain and reports whether the target was met on the way, the
other reports whether the target sits on either neighbour chain. Each jump then
becomes a plain continue at the top level of the loop body. A null target lets
the first one also cover the four walks that never tested for one, leaving the
file three lines shorter than it is with the goto.
Checked against the goto version by transcribing both loop bodies into a harness
and comparing the skip decision and the resulting segment and neighbour links of
every track over 400000 random link graphs, 71% of which took a skip path and
100000 of which reached the merging stage: no differences.