Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Code coverage slowing editor on enter playmode and assembly reload

Discussion in 'Testing & Automation' started by liortal, Jun 6, 2021.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Using the "editor iteration profiler" i was able to see this information:

    upload_2021-6-6_16-30-20.png

    This is the stack trace (in case the screenshot is not clear):
    Code (CSharp):
    1. UnityEditor.dll!UnityEditor::EditorAssemblies.ProcessInitializeOnLoadAttributes()
    2. mscorlib.dll!System.Runtime.CompilerServices::RuntimeHelpers.RunClassConstructor()
    3. mscorlib.dll!System.Runtime.CompilerServices::RuntimeHelpers.RunClassConstructor()
    4. Unity.TestTools.CodeCoverage.Editor.dll!UnityEditor.TestTools.CodeCoverage::CoverageReporterStarter..cctor()
    5. Unity.TestTools.CodeCoverage.Editor.dll!UnityEditor.TestTools.CodeCoverage::CommandLineManager.get_instance()
    6. Unity.TestTools.CodeCoverage.Editor.dll!UnityEditor.TestTools.CodeCoverage::CommandLineManager..ctor()
    7. Unity.TestTools.CodeCoverage.Editor.dll!UnityEditor.TestTools.CodeCoverage::CommandLineManagerImplementation..ctor()
    8. Unity.TestTools.CodeCoverage.Editor.dll!UnityEditor.TestTools.CodeCoverage::CommandLineManagerImplementation.ParseCoverageOptions()
    I realize 300ms is not much, but this quickly adds up with other plugins and 3rd party packages we have in the project. Also, seems like it might be avoidable, so why not ?

    This is the problematic code (getting a list of assemblies):
    Code (CSharp):
    1.            if (m_IncludePaths.Length > 0)
    2.                     m_IncludeAssemblies = AssemblyFiltering.GetAllProjectAssembliesString();
    3.                 else
    4.                     m_IncludeAssemblies = AssemblyFiltering.GetUserOnlyAssembliesString();
    m_IncludePaths is empty, it falls back to getting "user only assemblies"
     
  2. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    87
    Thank you @liortal - will fix this in the next version
     
    liortal likes this.
  3. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    87
    The fix is available in version 1.1.0 and 1.0.1
     
    karl_jones likes this.
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562