Optimizes player heads by adding a cache#2348
Draft
Zailer43 wants to merge 2 commits intoCaffeineMC:devfrom
Draft
Optimizes player heads by adding a cache#2348Zailer43 wants to merge 2 commits intoCaffeineMC:devfrom
Zailer43 wants to merge 2 commits intoCaffeineMC:devfrom
Conversation
Author
|
Apparently there are moments during 1 or 2 frames heads that had the texture loaded stop having it loaded, I don't understand why and then I should investigate this. It usually happens in rare situations where the inventory has heads and in one frame all of them lose the skin or an entity that has a head during a frame stops having it. Edit: now that I think about it, I have only seen this bug on one server, I haven't been playing much on others, but as it happens very rarely (maybe once every 4 hours) I haven't reproduced it on other servers or singleplayer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request avoids creating RenderType and getting the skin from the skinmanager every time a player head (inventory, block or placed in the armor slot) was rendered, as they are costly and currently took a similar amount of time as rendering the head itself.
Expected changes
Although, in singleplayer this change should not affect almost anything, in servers or maps where there is a high level of detail and many heads are used it should give a slight improvement, and as you can see in the screenshots below, in general it reduces the micro-stutter.
Spark
These spark tests were run for 30 seconds in the world with a chunk of heads. You can see that where before rendering the heads cost 13396ms it now takes 9000ms
dev branch: https://spark.lucko.me/KDvsr25bBC
this pr: https://spark.lucko.me/Tq8Ek2tpsE
Screenshots
A chunk of heads, worst-case scenario
this prdev branch
Entities with custom player heads
this pr
dev branch
A chest full of custom heads
this pr
dev branch
Hypixel's worst optimized lobby
this pr
dev branch