Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

LocalCacheServer.GetLocalCasheServerPort() Huge GC and low performance

Discussion in 'Editor & General Support' started by NawarRajab, Jun 14, 2019.

  1. NawarRajab

    NawarRajab

    Joined:
    Aug 23, 2017
    Posts:
    18
    Hi there,
    I'm working on a node-based data saving solution that uses xNode (https://github.com/Siccity/xNode) as a base. and it looks like this:
    upload_2019-6-14_14-27-5.png

    Lately, I've noticed very low performance when adding and removing nodes (takes 4 seconds). It's worth noting that vanilla xNode doesn't have this issue. But my custom nodes are quite simple , they only contain helper methods to find child node.
    Upon further inspection, it seems the spike happens with LocalCacheServer.GetLocalCasheServerPort()

    upload_2019-6-14_14-26-38.png
    That's 40MB of GC! So my question is, what would cause to be this slow and produce lot's of GC?
     
  2. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    148
    Try expanding the entry to see which methods inside it are causing the GC Alloc
     
  3. NawarRajab

    NawarRajab

    Joined:
    Aug 23, 2017
    Posts:
    18
    @Siccity it's seems to be caused by ~60K GC.Alloc call triggered by "Write asset changed to disk"
    upload_2019-6-17_11-40-53.png

    and each GC.Alloc:
    upload_2019-6-17_14-26-56.png
     
    Last edited: Jun 17, 2019
  4. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    148
    Try disabling autosave in xNode preferences.
     
  5. NawarRajab

    NawarRajab

    Joined:
    Aug 23, 2017
    Posts:
    18
    @Siccity That did the trick. Does that mean I need to "save project" in order for the scriptable object to be saved?
     
  6. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    148
    Yes. By default xNode saves the asset to disk every time you add a node. Disabling autosave you gotta hit ctrl+s