CraftTweaker

CraftTweaker

151M Downloads

Tooltip code has performance issues.

Darkhax opened this issue ยท 0 comments

commented

There are several things done in the tooltip handler which can be slow. A tooltip cache is generated when you connect to a server, meaning your code is executed for every item in the game when the player connects to a server.

One sourse of delay is the Keyboard.isCreaded method. This method has a fair bit of overhead. I would suggest completely dropping it. I have several tooltips with similar keybind mechanics that have not ran into issues with the keyboard not being created. You can find an example here. I use GameSetting#isKeyDown which does not check if the keyboard is created. If you are somehow having issues with this, looking into try/catching may be a better approach.

Here is a profile sample from CJ[Overloaded] (CJ#1923)
image