Search Unity

Really bad performance in 2018.3 beta vs 2018.2 release

Discussion in '2018.3 Beta' started by Daragorn, Dec 1, 2018.

  1. Daragorn

    Daragorn

    Joined:
    Feb 24, 2014
    Posts:
    34
    [EDITED]: I submitted a bug report for this, Case 1105749

    Hi,
    i made a very simple test project to compare the release version and the beta version and i found that the beta version performs drastically worst than the released one for unknown reasons.

    My system:
    cpu: i5-3570k 3.4GHz
    gpu: geforce gtx 1060 3Gb
    ram: 8Gb

    The "project" just consist of spawning a random number of cubes and moving them randomly on update by changing their position to a random value.

    When i run this project on 2018.2 i can spawn and move 50k cubes and get 10ish fps (cpu usage 50%, ram 50%, gpu 6%).
    When i run the same project on 2018.3b12 and spawn the same 50k cubes it either crashes or, if it manages to create them (after like 1 minute) then i get 0fps and it blocks (cpu usage 30%, ram 60%, gpu 0%). If i spawn only 5k cubes, i still get something like 3fps (vs 190fps on 2018.2)

    The problem seems to lie in the update position loop which works fine in 2018.2 but doesn't for unknown reasons in 2018.3b12.
    If i remove the update loop, infact, and just spawn the same 50k cubes, on both versions i get 50ish fps.

    Even weirder, i tested the same project on my laptop, which is theoretically much worst than my pc and i get 10ish FPS with 50k cubes on it, with the beta version 2018.3b05.
    Laptop spec:
    cpu: intel i5 7300 2.5GHz
    gpu: geforce gtx 1050ti
    ram: 8Gb

    The update loop is just this simple function (where "list" is, obviously just the 50k cubes list):
    for (int i = 0; i < list.Count; i++)
    {
    list.transform.position = new Vector3(Random.Range(-500, 500), 0, Random.Range(-500, 500));
    }

    I don't get why there is such a difference in performance, nor, actually, why my fps are so low even on the 2018.2 considering the profiler shows that cpu/ram are at 50% usage and the gpu is not even being used at all....there should be a lot more computing power still available, so why unity3d goes so slow?


    EDIT:
    i think i found where the problem lies. It seems to be in the box collider that the cubes have. If i remove it, then i get the same performance on 2018.3b12 and on 2018.2, which is around 20ish FPS for 50k cubes (actually, it is even a bit better on 2018.3b12).
    But if i reactivate the box collider, then i still get the 10ish fps on 2018.2 and 0fps on 2018.3b12
     

    Attached Files:

    Last edited: Dec 1, 2018
    Artaani likes this.
  2. Daragorn

    Daragorn

    Joined:
    Feb 24, 2014
    Posts:
    34
    And maybe they are interested in knowing that there is something wrong going on, since it is a beta, don't you think?
    That's what beta are for: to report bugs you find

    The weird thing is that the 2018.3b5 seems to be working fine while the following ones don't. At least i get good performances on my laptop with that one. I am downloading the 2018.3b12 on it too and see if it still get good performances (so it is some bug related to the hardware) or it get worst (so it is a bug related to the latest versions)
     
    Gametyme likes this.
  3. Daragorn

    Daragorn

    Joined:
    Feb 24, 2014
    Posts:
    34
    Ok, i found where the issue lies finally.
    I changed the "broadphase Type" setting in the physic setting from "Sweep and Prune Broadphase" (which was the default one) to "Multibox Pruning Broadphase" and now i get the same 10ish fps with 50k boxes even on 2018.3b12.

    On the laptop, though, with version 2018.3b5, both physic settings still gave same performance, so it seems some bug that came out with later versions
     
  4. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,267
    Could you please submit a bug-report, with that test project, as described in this document:
    https://unity3d.com/unity/beta/guide-to-beta-testing#tab-3

    After you submitted the bug-report, you receive a confirmation email with a bug-report Case number. Please post this Case number here (in this forum thread) for Unity staff to pick up.
     
  5. Daragorn

    Daragorn

    Joined:
    Feb 24, 2014
    Posts:
    34
    I already submitted it...ok i didn't think about putting the case number in the thread too. I just updated the first post with it ;)
     
    Peter77 likes this.
  6. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,267
    Great, thank you.

    For future posts: I believe it's also a good practice to put the Case number it in the forum thread title. It makes easier for Unity to see there is actually a bug-report for that post, perhaps increasing the chance that someone is looking into it (earlier).
     
  7. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    4,634
    Are you moving static colliders around? 50K at a time?
    What happens if you add rigidbody as per the documentation advise you to do?

    Maybe the new version of the PhysX is more sensitive about the high number of static colliders moving around the scene.
     
  8. Daragorn

    Daragorn

    Joined:
    Feb 24, 2014
    Posts:
    34
    I tried adding the rigidbody to the cubes and performances gets worst (as i was actually expecting. Despite what the manual says, i have always noticed that moving around static colliders without rigidbodies actually gave me better performances than adding a rigidbody to them, either kinematic or not).

    I tried both with kinematic colliders and non-kinematic with a layer where no collisions where occurring.

    With that setup i got (with the same 50k cubes):
    2018.3b12
    -2fps with the Multibox Pruning Broadphase
    -1fps with the Multibox Pruning Broadphase and doing the loop in FixedUpdate instead of Update
    -0fps with the Sweep and Prune Broadphase (and i had to close unity by killing the process through windows)

    2018.2:
    -3fps

    So performance in that case was the same on release and beta (assuming you change the default physic broadphase....so the problem with the default broadphase being less performant than in previous beta versions still remains).

    As for the question"50k at a time?". Yes, i know this is a lot and probably you'll never even need it...but it was exactly to test the performance of the new version of unity ;)