Skip to content
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

Optimise custom map rendering #11000

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

barnabwhy
Copy link

@barnabwhy barnabwhy commented Jun 29, 2024

  • Remove floating point math from getDistance in org.bukkit.map.MapPallete
  • Use bitwise & for bounds checks in obc.map.CraftMapCanvas to reduce comparisons Removed
  • Reduce size of image being drawn in drawImage if it is larger than the available size.
  • Use System.arraycopy to avoid iterating over the colors in the image.
  • Swap x and y loops in CraftMapRenderer.render to be more cache-friendly

Saw a ~30% performance improvement in obc.map.CraftMapView.render()

Tested with a world containing many custom maps created using the ImageOnMap plugin, modified to remove this optimisation so that it renders every tick.
Before: https://spark.lucko.me/NVdWKmSlFr
After: https://spark.lucko.me/j6AJiFG9pD

@barnabwhy barnabwhy requested a review from a team as a code owner June 29, 2024 11:24
@barnabwhy barnabwhy requested a review from kennytv July 9, 2024 23:04
@kennytv
Copy link
Member

kennytv commented Jul 15, 2024

Thanks, I'll get to it some time in the following week(s)

@barnabwhy
Copy link
Author

rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

3 participants