Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

[WIP] Optimize Bukkit's MapPalette #308

Closed
wants to merge 43 commits into from
Closed

Conversation

metabrixkt
Copy link
Contributor

Optimization for MapPalette, heavily optimized rewrite of getDistance(Color c1, Color c2), matchColor(Color color) methods and others a bit.

Don't merge until it's tested well and no issues found.

Reopening because of changed branch.

@Titaniumtown
Copy link
Collaborator

I have a few questions:
What exactly does MapPallete do and where is it used?
What sort of benefits would this give in a real-world scenario?
Do you have any numbers on how much faster this is?

@MrIvanPlays
Copy link
Contributor

MrIvanPlays commented Dec 17, 2020

Do you have any numbers on how much faster this is?

my tests prove a decrease of 38ms from the original code to that code. we're currently working on resolving the remaining problems with the color comparisons.

What sort of benefits would this give in a real-world scenario?

plugin drawing custom stuff on a map.

What exactly does MapPallete do and where is it used?

matches colors from a picture to the nearest ones that minecraft allows on maps. used when a plugin wants to draw an image to get the nearest colors of every pixel.

@Titaniumtown
Copy link
Collaborator

@MrIvanPlays Thanks for the info!

@metabrixkt metabrixkt changed the title [WIP] Optimize Bukkit's MapPalette Optimize Bukkit's MapPalette Dec 21, 2020
Ivan Pekov added 8 commits December 22, 2020 16:19
fixed build but wasn't able to fix the colors problem :/
looks like the problem is not the color comparison code anymore, but the way doubleColors is initialized
it works for MapTest but doesn't want to work properly for that array :/
color lighting still isn't right. I've returned the getDistance calls to the double one, as it is more acruate.
there is some improvement from changing the getDistance calls tho.
@MrIvanPlays MrIvanPlays changed the title Optimize Bukkit's MapPalette [WIP]Optimize Bukkit's MapPalette Jan 6, 2021
@MrIvanPlays MrIvanPlays changed the title [WIP]Optimize Bukkit's MapPalette [WIP] Optimize Bukkit's MapPalette Jan 6, 2021
@MrIvanPlays MrIvanPlays marked this pull request as draft January 6, 2021 11:43
@metabrixkt metabrixkt changed the base branch from ver/1.16.5 to staging/1.16.5 March 9, 2021 16:32
@metabrixkt
Copy link
Contributor Author

I'm going to open new PR for this optimisation soon.

@metabrixkt metabrixkt closed this Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants