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

Feedback URP performance: hefty regression in editor, steady @ runtime

Discussion in '2021.2 Beta' started by laurentlavigne, Apr 5, 2021.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Quick benchmark to check out regressions and such.
    With a fps script that uses ongui, frequency 30 seconds, 2060rtx i5 8400
    Scene uses no realtime lights or lightprobes, 1 refprobe, all baked & realtime volume lit by The Bakery, 20 vfx graph, 580K tris, 100 skinmesh, rufat's post processing bloom

    editor fullscreen 1280x720:
    2020.1.17 105fps
    2021.1.1 80fps
    regression of 25%

    build fullscreen 1440p:

    2020.1.17 328fps -> 310fps (drops slowly to 310)
    2021.1.1 296fps -> 310fps (ramps up slowly to stabilize at 310fps)
    ==
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you share the FPS script?
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. [AddComponentMenu( "Utilities/HUDFPS")]
    5. public class FPS : MonoBehaviour
    6. {
    7.     // Attach this to any object to make a frames/second indicator.
    8.     //
    9.     // It calculates frames/second over each updateInterval,
    10.     // so the display does not keep changing wildly.
    11.     //
    12.     // It is also fairly accurate at very low FPS counts (<10).
    13.     // We do this not by simply counting frames per interval, but
    14.     // by accumulating FPS for each frame. This way we end up with
    15.     // corstartRect overall FPS even if the interval renders something like
    16.     // 5.5 frames.
    17.  
    18.     public Rect startRect = new Rect( 10, 10, 75, 50 ); // The rect the window is initially displayed at.
    19.     public bool updateColor = true; // Do you want the color to change if the FPS gets low
    20.     public bool allowDrag = true; // Do you want to allow the dragging of the FPS window
    21.     public  float frequency = 0.5F; // The update frequency of the fps
    22.     public int nbDecimal = 1; // How many decimal do you want to display
    23.  
    24.     private float accum   = 0f; // FPS accumulated over the interval
    25.     private int   frames  = 0; // Frames drawn over the interval
    26.     private Color color = Color.white; // The color of the GUI, depending of the FPS ( R < 10, Y < 30, G >= 30 )
    27.     private string sFPS = ""; // The fps formatted into a string.
    28.     private GUIStyle style; // The style the text will be displayed at, based en defaultSkin.label.
    29.  
    30.     void Start()
    31.     {
    32.         StartCoroutine( FP() );
    33.     }
    34.  
    35.     void Update()
    36.     {
    37.         accum += Time.timeScale/ Time.deltaTime;
    38.         ++frames;
    39.     }
    40.  
    41.     IEnumerator FP()
    42.     {
    43.         // Infinite loop executed every "frenquency" secondes.
    44.         while( true )
    45.         {
    46.             // Update the FPS
    47.             float fps = accum/frames;
    48.             sFPS = fps.ToString( "f2");
    49.  
    50.             //Update the color
    51.             color = (fps >= 30) ? Color.green : ((fps > 10) ? Color.red : Color.yellow);
    52.  
    53.             accum = 0.0F;
    54.             frames = 0;
    55.  
    56.             yield return new WaitForSeconds( frequency );
    57.         }
    58.     }
    59.  
    60.     void OnGUI()
    61.     {
    62.         // Copy the default label skin, change the color and the alignement
    63.         if( style == null ){
    64.             style = new GUIStyle( GUI.skin.label );
    65.             style.normal.textColor = Color.white;
    66.             style.alignment = TextAnchor.MiddleCenter;
    67.         }
    68.  
    69.         GUI.color = updateColor ? color : Color.white;
    70.         GUI.Label( new Rect(0, 0, startRect.width, startRect.height), $"{sFPS} FPS", style );
    71.     }
    72. }
     
    PutridEx and nico_st_29 like this.
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It's likely that the editor portion of the gameloop got slower. Could you report a bug on this?
     
    nico_st_29 and laurentlavigne like this.
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    1326946
     
    MP-ul, PutridEx and nico_st_29 like this.
  6. DoctorShinobi

    DoctorShinobi

    Joined:
    Oct 5, 2012
    Posts:
    219
    You've been reporting a lot of good performance regression bugs lately. I'm sure our lord and savior @Peter77 is proud up there in the sky.
     
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    shame he ascended *with* his RTX 2080
     
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    It's not really related to the RTX Unity Technologies sent me, it's more related to my interests having shifted. That's mainly the reason why I'm not so much around here lately. But I see how it looks like I was bought and it's a funny thought. :D