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

Bug Dramatic slowdown of build process

Discussion in '2022.1 Beta' started by ImpossibleRobert, Feb 8, 2022.

  1. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Hi,

    I am really desperate here.

    Spoiler

    2021.1.28 - 0:48s
    2022.1.b6 - 4:43m

    Details

    In my project I am building addressables programmatically. I now did a test upgrade to the beta 6 to see if there are any changes. While functionality wise things are great, the performance of the build became FACTORS slower, up to a point where this is a showstopper since during normal iteration we are rebuilding addressable bundles a lot.

    The steps that take the most time are the assembly compilation and even worse, the variants preparation. This happens EVERY time, even if nothing has changed. And it takes so long, see comparison above.

    Compiling Assembly Definition Scripts 20s
    Preparing variants for compilation (63M / 226M), multiple times, 3:30 min and more

    Is there anything I can do to get the performance of 2021.1 back? Is this a bug or a feature or a configuration issue? The project is nearly the same except for the upgrade.

    Cheers, Robert
     
  2. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    ImpossibleRobert likes this.
  3. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    162
    Heyhey,
    Wanted to check, are you using URP?
    If yes, do you have a lot of ShaderGraph shaders in your project?
     
  4. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Yes URP and quite a lot of assets imported but my scenes only use the Lit and Simple Lit shaders. I'll open a bug report and I can also share the project if that helps. It is just huge though, so will need to share git credentials with the Unity team.
     
  5. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Bug Report: CASE 1401628
     
    LeonhardP and EvOne like this.
  6. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Here another finding. I just did a test with 2021.2 as well. That is at 2:40min. So now we have:

    2021.1.28 - 0:48s
    2021.2.12 - 2:40m
    2022.1.b8 - 4:43m

    It makes me really fear what will happen in 2022.2. But kidding aside, this is unbearable.
     
    laurentlavigne, EvOne and DINmatin like this.
  7. DINmatin

    DINmatin

    Joined:
    Aug 21, 2014
    Posts:
    14
    hi,
    is there any news on this? bug confirmed? can't find it in the issue tracker.
    we face the exact unbearable situation as ImpossibleRobert.

    unity 2020.3.30 - 04:48 min - 269 seconds
    unity 2021.2.13 - 01:15:11 hours - 4507 seconds

    urp - use of shaderGraph + vfxGraph, android (quest)
     
    anders_hg and ImpossibleRobert like this.
  8. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    The bug report is in, I shared my huge project. The team (I think @BerontasUnity) replied they are still investigating last week. This is an absolute showstopper for me and it seems for you as well.
     
    EvOne and DINmatin like this.
  9. BerontasUnity

    BerontasUnity

    Unity Technologies

    Joined:
    Sep 17, 2020
    Posts:
    1

    Hello, could you please report this issue through the bug reporter and attach your project? we're looking for a more manageable project at the moment. If you'd do so, please mention the bug report number here. Thank you!
     
    mahdi_jeddi and ImpossibleRobert like this.
  10. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    B10 seems to have improved the step "compiling assembly definition scripts". The build time is consistently down from 4:43m to 3:59m. So we saved 40 seconds somewhere.

    The main time-eater is still "Preparing variants for compilation". This did not exist in 2021.1 and takes around 3 minutes each build. This is the step the Unity developers need to investigate and improve.
     
    EvOne likes this.
  11. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    It existed back then as well, it just took less time. We're aware of the issue and are working on it, but, unfortunately, it won't be a quick fix.
     
    ImpossibleRobert likes this.
  12. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    It doesn't need to be a quick fix, but should be a high-priority fix.
     
  13. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    As I said, we're working on it :)
     
    DINmatin and ImpossibleRobert like this.
  14. DINmatin

    DINmatin

    Joined:
    Aug 21, 2014
    Posts:
    14
    hej,

    i now reported my case #1408905
    in 2021.2.14 my build takes really long - it quits after about 4500s - that's new.
    giving up.
     
    EvOne and ImpossibleRobert like this.
  15. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Latest measurement with 2022.1.b13 - 4:08min, so no improvement yet
     
    EvOne and DINmatin like this.
  16. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    I was hoping for a miracle but still 4:03min instead of 0:48s with b15.
     
    EvOne likes this.
  17. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    I'll post here when we know when the fix lands :)
     
  18. VinylPixels

    VinylPixels

    Joined:
    Dec 10, 2016
    Posts:
    13
    So there's nothing that can be done on our side?
    It's not THAT hard for us but still 6 minutes of build time instead of 1 :/

    Any more info on the cause and solutions you are working on?
    We're on 2021.2.19.f1
     
  19. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    There's just too many
    #pragma multi_compile
    directives. The large number of variants it has to go over before stripping causes the slowdown.
    We'll probably share something when we're ready :)
     
  20. evyatron

    evyatron

    Joined:
    Jul 20, 2014
    Posts:
    132
    I hope this doesn't come off as patronising - but any chance build times will be introduced as part of your testing process of releases?

    I imagine before releasing a build you run a suite of tests on several projects you have? And presumably several of those tests are building projects, from small to large? It sounds like in this instance the test results would show a massive increase in build times - making Unity either fix it before shipping, or at least include it as a known issue in the release notes (checked most recent version, it's not there)?
     
  21. TG1980

    TG1980

    Joined:
    Oct 23, 2013
    Posts:
    40
    You are assuming regression testing is taking place. Unity has to start using their own tools and they have to start testing things. The most recent betas have a broken inspector of all things. I think that's quite telling of nobody booting it even once as it's quite hard to miss.

    They should force all their developers to use a HUGE semi-real-life project and stop testing with empty projects. They'd instantly notice how slow the editor and everything else have gotten. You just can't detect problems with a minimal dummy project or by not using your own tools.

    @aleksandrk Care to elaborate on your build time regression test setup? I'd be interested in hearing what is there right now and how this could be avoided in the future, as it's a common theme over the years and it kills productivity.
     
    Last edited: Apr 23, 2022
    Wattosan, Havokki and DINmatin like this.
  22. TG1980

    TG1980

    Joined:
    Oct 23, 2013
    Posts:
    40
    Hi @aleksandrk! Would you mind letting us know what kinds of regression tests are at place at Unity to prevent build times from ballooning? It is a constant hassle that build time regressions happen quite often; regressions that would be evident if a normal size project was built with Unity.

    Thank you.
     
  23. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Good news: Unity acknowledged the bug. IN-8037. Since then no further replies though or changes. I have no idea if that is something which will be looked at soonish or not. From my perspective it should have very high priority. @aleksandrk do you have any insights?
     
  24. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    So, the fix for warm builds landed in 2023.1.0a14, 2022.2.0b15 and 2021.3.15f1.
    Cold builds benefit from the fix as well, but not as much as warm builds.
     
    ImpossibleRobert likes this.
  25. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    I assume warm = already built before one time?
     
  26. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    Warm = shader cache filled, yes :)
    During the cold build most of the time is usually spent compiling shader variants, not filtering them.
     
    ImpossibleRobert likes this.
  27. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    This sounds really promising! Do you have any measurements to share? Initial compile is not an issue if the subsequent ones are fast. I am eager to test this and will do so over the New Year timeframe. If that really works it is the best Christmas present :)
     
  28. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
  29. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    The results sound very good indeed, keeping my fingers crossed I have not some unsupported scenario.