Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Case 1086243] Physics query performance vs 2018.2

Discussion in '2018.3 Beta' started by KillHour, Oct 2, 2018.

  1. KillHour

    KillHour

    Joined:
    Oct 25, 2015
    Posts:
    49
    This is a crosspost from the physics thread - I was encouraged to repost it here. After updating to 2018.3.0b3, I had a very severe slowdown of about 2 orders of magnitude when doing physics queries.

    2018.2:
    View attachment 310123
    2018.3:
    View attachment 310126

    Physics calls seem to go from ~0.02ms to ~1ms. Checked Physics.BoxCastNonAlloc, Physics.SphereCastNonAlloc, Physics.Raycast, Physics.RaycastNonAlloc and Physics.OverlapCapsuleNonAlloc.

    There are 10s of thousands of colliders in the scene.

    I tried disabling Auto Sync Transforms with very little improvement.

    Case 1086484 is a reupload with everything except level loading, physics-related colliders and a single system with a box cast stripped out to hopefully isolate the issue as much as possible.
     
    hippocoder, LeonhardP and Peter77 like this.
  2. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    24
    Hey!

    We were able to repro the issue internally with your help, thanks!

    Expect some more news in the coming weeks.

    Cheers!
     
  3. KillHour

    KillHour

    Joined:
    Oct 25, 2015
    Posts:
    49
  4. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    24
    Hey!

    Turns out the problem was a redundant method call done in every query that took up a lot of time. The call wasn't actually necessary (and really slow too) so it's been removed and the queries should be blazing fast again starting with Unity 2018.3.0b6. Find it here, when it's available some time this week.

    Let us know if you encounter any other problems with the new release as well.

    Cheers!
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thanks for the performance hike :)
     
  6. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi @CookieSalad , i read the Known Issues in 2018.3 b6 and the links pointed me to this thread where you say the issues should be fixed in b6, and it is yet in the "Known Issues" list.

    Is this actually fixed or the "Released Notes" needs to be changed !?

    Thanks !
     
    Thygrrr likes this.
  7. hunterofakara

    hunterofakara

    Joined:
    Oct 4, 2018
    Posts:
    21
    Same case seems to also be in the "fixed" list for b6 - Definitely one of those places needs editing out in the release notes
     
    Vagabond_ likes this.
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Well spotted and easily missed. I just messaged the release manager who'll get that removed from the Known Issues list. Thanks.
     
    LeonhardP, yant and Vagabond_ like this.
  9. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    ... aaaaannnd it's gone.
     
  10. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    @CookieSalad @MelvMay The bug report mentions it was "found in 2018.2.9f1" and we're indeed running into the same issue when comparing performance of 2018.1.4f1 to 2018.2.13f1, which prevents up from upgrading. Are there plans to backport the fix to 2018.2.14f1 perhaps? We have a ton of issues on 2018.1.x that were mostly fixed in 2018.2.x but so far no 2018.2.x release was stable enough for us to upgrade.
     
  11. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Note that I'm 2D physics so I'm acting as an intermediary. ;)

    I'm not exactly sure why the issue tracker for 1086243 is showing as found in "2018.2.9f1" because the case internally is shown as found in "2018.3.0b3". The issue reported for 1086243 was caused by the multi-scene physics feature and cannot affect anything prior to 2018.3.

    It seems that the case 1086484 was marked (perhaps incorrectly) as a duplicate but that simply cannot be the case if it is indeed the same thing. Perhaps this is why the issue tracker is showing 1086243 as found in "2018.2.9f1" because 1086484 was found then. I can ping QA about this and mention it to the 3D team.
     
    hippocoder likes this.
  12. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    The issue tracker is mentioning 2018.2 because that's the version of the bug reporter the bug was reported with. I've changed the value. It will display the correct version with the next refresh.
     
  13. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    As yes I see it now but the bug report also states "regressed in 2018.3.0a6" so it seems two separate issues are being referred to as one. The internal details on that case relate to a fix that regressed in multi-scene.
     
    LeonhardP likes this.
  14. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    24
    Hey,@andererandre!

    This sounds like a completely different issue. Could you please provide us with a repro project that would allow us to repro the issue internally?

    Feel free to leave the case number for it in this thread.
     
  15. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Bug is reported, case ID is 1094014. Here are the two profiler samples, which are also included in the bug report. Note that the overhead is outside of the "Physics.OverlapSphereNonAlloc" profiler sample that's shown by default.

    Profile-2018.1.4f1.png
    Profile-2018.2.13f1.png

    EDIT: It's the same no matter if the queries are done in Update or FixedUpdate.
     
    Peter77 and LeonhardP like this.
  16. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    24
    hippocoder and Peter77 like this.