Skip to content

Optimize GameRules to use LinkedHashMap#1938

Merged
aikar merged 1 commit into
PaperMC:masterfrom
Spottedleaf:optimize-gamerules
Apr 6, 2019
Merged

Optimize GameRules to use LinkedHashMap#1938
aikar merged 1 commit into
PaperMC:masterfrom
Spottedleaf:optimize-gamerules

Conversation

@Spottedleaf
Copy link
Copy Markdown
Member

Previously TreeMap was used which has poor get(K) performance.

Using LinkedHashMap we can get the performance benefit of HashMap and the iteration order given by TreeMap.

@killme
Copy link
Copy Markdown
Contributor

killme commented Apr 5, 2019

Doesn't this change the iteration order?
LinkedHashMap is by insertion order, TreeMap is by key order.

@Byteflux
Copy link
Copy Markdown
Contributor

Byteflux commented Apr 5, 2019

Doesn't this change the iteration order?
LinkedHashMap is by insertion order, TreeMap is by key order.

The order of the original TreeMap should be preserved since the entries in the tree map are being added to the LinkedHashMap using putAll(treemap).

Previously TreeMap was used which has poor get(K) performance.
@aikar aikar force-pushed the optimize-gamerules branch from 1e694ce to 33a5a0f Compare April 6, 2019 03:25
@aikar aikar merged commit 33a5a0f into PaperMC:master Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants