Search Unity

Why do WebGL builds take an unreasonable amount of time and resources to complete?

Discussion in 'Web' started by Shadoninja, Dec 6, 2018.

  1. Shadoninja

    Shadoninja

    Joined:
    Nov 12, 2013
    Posts:
    26
    I have a Ryzen 2700x processor, 32GB of RAM, and my Unity project is sitting on a Ramdisk. I have an incredibly powerful workstation that has delivered in every category over the last 2 months for both heavy workstation use and gaming. That came to a screeching halt when I did a WebGL build of my Ludum Dare 43 game this weekend.

    My computer takes over 10 minutes to make the build. My 8 core/16 thread processor gets pinned at 100% utilization and the computer is nearly unusable during the entire process.

    What in the world is going on during a WebGL build that brings my computer to its knees?
     
    Last edited: Dec 6, 2018
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    It's running IL2CPP, Emscripten, and then packing and compressing your content. Also, the first time you build, it may be compiling shader variants, which can take a while. After the first build it should be a lot faster.

    I am curious how much the Ramdisk has helped. Maybe you could benchmark it with/without the ramdisk?
     
  3. Shadoninja

    Shadoninja

    Joined:
    Nov 12, 2013
    Posts:
    26
    I went ahead and ran a mini benchmark for you:

    WebGL build on Samsung 860 EVO (SSD): 11m 56s
    WebGL build on 8GB CORSAIR Vengeance LPX ramdisk (2800MHz): 11m 22s

    That is roughly a ~5% performance gain which I would consider negligible. I think the performance between the two storage options is so similar because the majority of the WebGL build is encoding/compression which would largely be the CPU's responsibility.
     
  4. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
  5. Shadoninja

    Shadoninja

    Joined:
    Nov 12, 2013
    Posts:
    26
    I poked around and the build options are quite limited. I would make a thread requesting command line parameters to be supported, but I have never gotten a response from anyone within the Unity organization about anything, so I will save the keystrokes haha.
     
  6. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    I really dont care how long it takes to do the build, as long as after all that crunching it's small and works!
     
    furfrog likes this.