Multiplayer icon indicating copy to clipboard operation
Multiplayer copied to clipboard

Added Ultrafast speed to TickRatePatch, changed if/else to switch

Open SokyranTheDragon opened this issue 2 years ago • 0 comments

Using the switch should allow compiler to better optimize the method (looking at decompiled code and IL code, it seems it is the case for this method).

We could use the switch expression instead of the switch statement - the issue with that however is that it introduces a temporary variable in compiled code (the value it later assigns to __result), as well as it needs the values to be floats explicitly as it'll otherwise use an int variable that it later converts to float.

Adding the Ultrafast speed doesn't really change much - the biggest change I've seen is that some mods that display target tickrate will now do so correctly on speed 4, where they previously would show incorrect value of 60.

SokyranTheDragon avatar Feb 04 '23 19:02 SokyranTheDragon