9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

Skip dirty stats copy when requesting player stats

There's literally only one getDirty call. Because the map was only retrieved once, we don't actually need to create a copy of the map just to iterate it, we can just access it directly and clear it manually after use.
This commit is contained in:
MrPowerGamerBR
2023-11-22 14:45:25 -03:00
parent 50c98ccbd5
commit a93396ebe5
3 changed files with 48 additions and 60 deletions

View File

@@ -27,10 +27,8 @@ SparklyPaper's config file is `sparklypaper.yml`, the file is, by default, place
* But still, if you made your own custom "image on map" plugin, don't forget to `mapView.isLocked = true` to get the same performance benefits in vanilla Paper!
* Fix concurrency issues when using `imageToBytes` in multiple threads
* Useful if one of your plugins is parallelizng map creation on server startup
* Optimize `ServerStatsCounter`'s dirty set
* Instead of using Java's HashSet, we will use fastutil's `ObjectOpenHashSet`, which has better performance
* While this seems stupid, awardStat was using around ~0.14% when adding to the `HashSet`, and that's not good
* We also optimized the `getDirty` calls. I mean, the *only* `getDirty` call. Because the map was only retrieved once, we don't actually need to create a copy of the map just to iterate it, we can just access it directly and clear it manually after use.
* Skip dirty stats copy when requesting player stats
* There's literally only one `getDirty` call. Because the map was only retrieved once, we don't actually need to create a copy of the map just to iterate it, we can just access it directly and clear it manually after use.
* ~~Avoid unnecessary `ItemFrame#getItem()` calls~~
* ~~When ticking an item frame, on each tick, it checks if the item on the item frame is a map and, if it is, it adds the map to be carried by the entity player~~
* ~~However, the `getItem()` call is a bit expensive, especially because this is only really used if the item in the item frame is a map~~