Search Unity

Test Tree View quadratically slower for huge number of tests

Discussion in 'Testing & Automation' started by einWikinger, Dec 8, 2020.

  1. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    I've known since a long time that the test runner test list view gets horrendously slow when you want to run lots of tests in the interactive editor. We got like 80k individual tests and trying to run them will take ages inside the TestTreeViewBuilder because it's O(n²) looking for previous test results:

    Code (CSharp):
    1. m_OldTestResultList.FirstOrDefault(a => a.uniqueId == testElementId);
    inside of
    TestTreeViewBuilder.ParseTestTree()
    .

    I think a simple O(n log n) lookup cache for the old test results would work wonders here.

    com.unity.test-framework@1.1.19
     
  2. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    In a quick test I've replaced m_OldTestResultList with a Dictionary<> instead of a List<> and it is magnitudes faster. Still not "interactive" I'd say but at least I don't have to wait half an hour for the editor to become responsive again.
     
  3. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    92
    Hey. Thanks for the feedback. We will make sure to take a look at it for our next round of performance optimization of the test framework.
     
    JesseSTG likes this.
  4. sbergen

    sbergen

    Joined:
    Jan 12, 2015
    Posts:
    53
    We reported this with a minimal repro and patch a month ago: Zendesk id #939374, bug report 1289626. Please check those out :)
     
    einWikinger likes this.