-
Notifications
You must be signed in to change notification settings - Fork 117
refactor(pathfinding): simplify functions to improve readability - Part 1 #1619
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
refactor(pathfinding): simplify functions to improve readability - Part 1 #1619
Conversation
xezon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, I do not think you need to merge multiline conditions into single line condition if it takes away the opportunity to place breakpoints.
It's the only real way to gain performance right now. if it needs debugging then the conditions can always be broken out again and checked at the time. |
Are you sure it gives performance? I expect that the generated assembler will be the same. |
|
Here is a simple example with godbolt: On O1 the generated code is already the same. |
The main thing would be if VC6 does this or something different. I am certainly getting better performance from some of the changes. |
|
It could be placebo. In the hope of better performance it is perceived as such. Merging conditions is not a strategy that is expected to give performance gains. At least I am not aware of it. Assembler has no concept of merged conditionals either. It separates merged conditions into separate instructions. |
I mean this PR in general has visible performance improvements when i run it compared to without the changes. I will take a look later and see if not combining the conditionals makes any difference. |
367bc04 to
460b860
Compare
|
Tweaked and pushed |
|
Is this ready to continue review? |
just need to make those two tweaks, just a sec. |
460b860 to
4a40608
Compare
|
Made the tweaks, should be good now |
xezon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the change title still accurate?
4a40608 to
a9d3754
Compare
|
Addressed comments and updated |
|
will sort out replicating to generals in a bit |
|
copied across to generals, testing each change at a time, hence the split commits. No real total performance improvement but i think it helps some areas that lag at times. Generals has a small difference in examineNeighbouringCells which was causing mismatching and some annoyance. But it was a single extra value within: while zero hour ommits the Not sure how we want to merge these, as individual commits or as squashed? If we go with individual commits i can rename all the commits to something more suitable etc. |
|
Can do 4 commits. Merge the Generals replications into the respective ZH commits. For commit title, use "refactor(pathfinder)" Also, sentence behind colon always starts with upper case. And append Pull number to commit titles. |
Skyaero42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Will look at doing that later, i will also pull out the function for checking cell extents into it's own commit as it will get used in other commits so don't want to lose it by mistake if the commit it is part of got reverted. |
…l::releaseInfo (#1619)
…:checkChangeLayers (#1619)
…:examineNeighboringCells (#1619)
…ideExtents (#1619)
…:internal_findHierarchicalPath (#1619)
0db6f1f to
555d0dd
Compare
|
Got the commits in order, should be good to go now, once this is merged i will tweak part 2 and add the changes to generals. |
…:examineNeighboringCells (#1619)
…:examineNeighboringCells (TheSuperHackers#1619)
…:internal_findHierarchicalPath (TheSuperHackers#1619)
Rebase and merge
This PR cleans up various functions within the pathfinding, the goal to improve readability where possible and to improve performance where possible.
I have broken each function down into it's own commit to aid review.
This PR covers the functions
A few of the refactors cover code simplification by inverting the logic and returning early or by simplifying functionality.
Todo