sp614x / optifine

1.79k stars 418 forks source link

Predicates Lag Issue #1500

Closed RubbaBoy closed 6 years ago

RubbaBoy commented 6 years ago

There has been a bug/issue in the game for nearly two years now, in which Mojang has refused to fix ever since it was reported here. It had to do with many predicates heavily lagging the game (By several hundred FPS for many users), as a certain part of a class mentioned in the comments looped through each predicate per item per tick. This is demonstrated in this video, showing the substantial difference this bug makes. I believe these repeated iterations could be cached, to reduce the amount of looping that had to be done.

Mojang has only marked this as "Works As Intended", and the reason is thought to have been because with taking such a feature to its limits and so far away from the actual game like this, it comes with a price, and Mojang doesn't want to invest time into fixing it for this reason. If they have an official statement on this issue I missed, I would love to see it, these words did not come from them, I don't want anything thinking they said this (Other than marking the bug as "Works As Intended").

I've talked to several map makers and resourcepack creators, and several of them have had to drop models because of the amount of lag it created, and the sheer amount of models and textures they had.

hafarooki commented 6 years ago

+1 I know of many servers/plugins/maps that take advantage of this feature which would benefit from having this fix implemented into Optifine even if Mojang refuses

winnipeg21 commented 6 years ago

+1 Hope this can be solved

ghost commented 6 years ago

+1

AL1L commented 6 years ago

+

sp614x commented 6 years ago

This looks interesting. It could probably be fixed with some caching.

sp614x commented 6 years ago

Testing the bugfix, baseline 600 FPS:

image

36 diamond hoes with 1560 custom models. Before 120 FPS:

image

After 500 FPS:

image

sp614x commented 6 years ago

Should the optimization be:

The second option looks best for now.

NickAcPT commented 6 years ago

In my opinion, it should be activated for models with more than 32 overrides.

RubbaBoy commented 6 years ago

Yeah, I think the second option would probably be the best. Are you just caching the items to an extent, or are you doing something more complicated?

sp614x commented 6 years ago

It is caching the combinations of item values and their corresponding models. The item values are quantized depending on the predicate test values to reduce the possible combinations.

sp614x commented 6 years ago

Preview OptiFine 1.12.2_HD_U_E2

The optimization is active for models with more than 65 predicates (the vanilla clock model has 65).

sp614x commented 6 years ago

Is the fix effective, FPS before/after?

RubbaBoy commented 6 years ago

Yeah, just tested it, I got an additional 500 FPS in some tests, thank you very much! I think a lot of people will be able to use feature/fix this with maps and resourcepacks.

SteveKunG commented 6 years ago

After implemented this, Latest OptiFine incompatible with Forge 2729 (latest).

sp614x commented 6 years ago

Updated preview E2 for 1.12.2 to be compatible with Forge #2729.