Skip to content

Conversation

@NonSwag
Copy link
Contributor

@NonSwag NonSwag commented Dec 8, 2024

Overview

Clamp the min and max y values to the min and max values of the chunk

Description

Adjusted the layer iteration logic in the Region class to use the minimum and maximum Y-values from the chunk. This prevents unnecessary iterations when getMinimumY or getMaximumY returns extreme values, improving performance efficiency.

### Submitter Checklist
- [x] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [x] New public fields and methods are annotated with `@since TODO`.
- [x] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).

Adjusted the layer iteration logic in the Region class to use the minimum and maximum Y-values from the chunk. This prevents unnecessary iterations when getMinimumY or getMaximumY returns extreme values, improving performance efficiency.
@NonSwag NonSwag requested a review from a team as a code owner December 8, 2024 11:53
@NonSwag
Copy link
Contributor Author

NonSwag commented Dec 8, 2024

I was not sure whether it would be more appropriate to use getMinSectionPosition or getMaxSectionPosition over getMinY or getMaxY
Input on that would be appreciated

Refactored the loop to reduce repeated evaluations by storing pre-calculated min and max values for Y coordinates. This change enhances readability and may improve performance by minimizing unnecessary calculations during the iteration process.
@PierreSchwang PierreSchwang added the Bugfix This PR fixes a bug label Dec 11, 2024
@PierreSchwang
Copy link
Member

Would be great if the variables would either be called minY instead of minLayer or keep them minLayer but put the bit shift directly after the Math.min/max instead of inside the loop - just so that the naming fits

@PierreSchwang PierreSchwang merged commit afec252 into IntellectualSites:main Dec 15, 2024
10 checks passed
@NonSwag NonSwag deleted the max-min-layer-performance branch December 15, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants