Deep profiling & OnSerializeBefore/After

I'm wondering why OnSerializeBefore/After requires that much performance when deep profiling in the editor. This doesn't happen when profiling normally or through an external build. This happens even with the release builds.

Any idea what is causing this?

Comments

  • Don't recall this, isn't "OnSerializeBefore" something from UNET?
  • My bad, it's NetworkState.Bolt.IEntitySerializer.OnSimulateBefore and NetworkState.Bolt.IEntitySerializer.OnSimulateAfter inside Entity.Simulate().
  • That is the simulation of entities for Bolt.
  • Maybe try switching to Release version and see if that improves your performance.
  • I'm already running the release binaries. Was just wondering why those two methods (and they are the only ones) are spiking that much when deep profiling is enabled.
  • This is likely an artifact of how this type of profiling works. Each tick every property in a pre-calculated before/after list are iterated for every entity. If you are using a lot of triggers/animator properties, these add to the after? list. Can't remember. Interpolated properties, some others get added too. This means there are a metric ton of iterations each tick that probably generate false-positive in the profiler. This generally is much worse when using the bolt animator stuff or triggers. Other properties are event driven and are not included in this list. Since I moved away from using the bolt animator stuff (to event driven state properties), most of that went away for me.