mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
perf: Application.isPlaying in hot path is slow (#3210)
This showed up during a recent il2cpp profile and is accounting for 1% of total cpu usage while being completely unnecessary outside of the editor https://share.dl.je/2022/08/2022-08-28_14-44-14_CfEcmlR1L6.png
This commit is contained in:
parent
aac75491ac
commit
17446f3aa3
@ -968,7 +968,11 @@ internal NetworkIdentitySerialization GetSerializationAtTick(int tick)
|
||||
// (otherwise [SyncVar] changes would never be serialized in tests)
|
||||
//
|
||||
// NOTE: != instead of < because int.max+1 overflows at some point.
|
||||
if (lastSerialization.tick != tick || !Application.isPlaying)
|
||||
if (lastSerialization.tick != tick
|
||||
#if UNITY_EDITOR
|
||||
|| !Application.isPlaying
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// reset
|
||||
lastSerialization.ownerWriter.Position = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user