Search Unity

Enabled exceptions on WebAssembly performance hit?

Discussion in 'Web' started by bartofzo, Jun 24, 2019.

  1. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
    Hi,

    I was wondering how much of a performance boost can be gained when setting Enable Exceptions to None as compared to Explicitly thrown only.

    Is there an overall performance boost, or only on code that uses try/catch blocks? I have a few pieces of code that rely on a catching an exception and they don't work if I disable exceptions entirely. Is it worth the cost of refactoring that code for the performance boost? (The try/catch blocks themselves are not in frame updates though)

    Thanks.
     
  2. bartofzo

    bartofzo

    Joined:
    Mar 16, 2017
    Posts:
    151
  3. Logic_Bomb

    Logic_Bomb

    Joined:
    Apr 6, 2017
    Posts:
    16
    The performance hit is negligible. Also, I believe it's only even an issue at all in Firefox which does not support javascript exception handling natively. As long as code execution isn't the main bottleneck (meaning what's slowing your frame rate - usually it's rendering) you'll be fine. If code execution is the main bottleneck, there are likely other things that could be optimized in your code that would make a bigger difference than this setting.

    *Edit* Just to be clear for anyone that has read the title and has skipped to the answer without reading the question specifics, it is only negligible between "none" and "explicitly thrown" as the OP has asked. A higher setting involving a stack trace should never be in a release build as the performance overhead would be enormous.
     
    Last edited: Jul 15, 2019
    De-Panther likes this.