# WasmCodeOptimization

> Options for the optimization mode to use for compiling Web code.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEditor.WebGL](/engine/6000.6/script-reference/unityeditor/webgl.md)
* **Assembly:** UnityEditor.WebGL.Extensions

```csharp
public enum WasmCodeOptimization
```

## Remarks

This enum provides optimization settings for WebAssembly (Wasm) code in Unity Web builds, enabling developers to balance file size, runtime performance, and build speed depending on their needs.

## Examples

```csharp
using UnityEditor;

class WebOptimizer
{
    [MenuItem("Example/Optimize For Disk Size")]
    static void OptimizeForDiskSize()
    {
#if UNITY_WEBGL
    // Set code optimization setting to optimize for disk size
    UnityEditor.WebGL.UserBuildSettings.codeOptimization = UnityEditor.WebGL.WasmCodeOptimization.DiskSize;
    // You will find the setting applied now in File > Build Settings > Web > Web Settings
#endif
}
}
```

## Fields

| Value                                                                                                        | Description                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [BuildTimes](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/buildtimes.md)           | Generate Web code that takes the least amount of time to build.                                                                                                                                                                                                                                                 |
| [DiskSize](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/disksize.md)               | Favor optimizations that minimize build size, at the expense of taking a longer time to build compared to [WasmCodeOptimization.BuildTimes](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/buildtimes.md).                                                                              |
| [DiskSizeLTO](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/disksizelto.md)         | Favor optimizations that minimize build size, at the expense of taking a longer time to build compared to [WasmCodeOptimization.BuildTimes](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/buildtimes.md). Also enable an additional Link Time Optimizations (LTO) stage.               |
| [RuntimeSpeed](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/runtimespeed.md)       | Generate Web code that’s optimized for runtime performance, at the expense of taking a longer time to build compared to [WasmCodeOptimization.BuildTimes](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/buildtimes.md).                                                                |
| [RuntimeSpeedLTO](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/runtimespeedlto.md) | Generate Web code that’s optimized for runtime performance, at the expense of taking a longer time to build compared to [WasmCodeOptimization.BuildTimes](/engine/6000.6/script-reference/unityeditor/webgl/wasmcodeoptimization/buildtimes.md). Also enable an additional Link Time Optimizations (LTO) stage. |
