Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Immense performance regression for physics in beta2

Discussion in '2017.2 Beta' started by PhilSA, Jul 12, 2017.

  1. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,189
    I am comparing the cost of an Physics.OverlapCapsuleNonAlloc in 2017.1f3 and 2017.2b2, and the latter takes about 4x more milliseconds than the former.

    I've noticed this performance difference seems to apply to pretty much all physics calls. My guess is that it's related to the new Physics.autoSyncTransforms feature?

    Anyway, since this is a beta, I'm not really complaining. I'm just mentioning this out of curiosity in case you guys have more information on autoSyncTransforms and if that performance hit is normal.
     
    Last edited: Jul 12, 2017
    MrEsquire likes this.
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
    Yes, all the queries have an automatic sync point to make sure the hierarchies are synced between Unity and the physics engine. I don't think there should be more cost to it.

    That said, one way to see the numbers you report would be to change a number of physics-related transforms and the then call a query. That query would have to apply the changes before proceeding, and that will take time (only in autoSyncTransforms=true mode though). I'd like to note that this cost was there before, as part of transform.position / transform.rotation setter. It's just that now it's concentrated around one call instead of being all over the place.

    Now, if you think this doesn't sound like what you're doing, please file a bug, we'll take a look.
     
    Peter77 likes this.
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,919
    If there's no code difference between 2017.1 and 2017.2 then this is certainly a bug.
     
  4. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,189
    I have to say I didn't test in a build, which I probably should try. But I'll file a bug if it's still a problem

    Also, I'm wondering if that extra cost is maybe only due to the fact that the profiler now has to display an entry for every "sync" call, and it didn't have to do that before
     
    Last edited: Jul 12, 2017
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,919
    File the bug, it's their job to work that out. They get paid for it :)
     
  6. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
    Thanks Phil. Appreciate the feedback.
     
  7. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    11
    Hey!

    Please file a bug on the Editor issue you're having anyway. If you feel you'd like to do some more testing, you're free to provide us with more info at a later time!
     
    Peter77 likes this.