# Optimization Tips

#### **Reduce instructions count**

DRM editor window displays information about instruction count used by a mask, this helps to analyze how expensive is the chosen mask:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FF9eIVoaHFZ8skeMpkSr9%2F47.png?alt=media&#x26;token=cefc58c6-2177-48b0-8c8c-8bd09ed843e6" alt="" width="345"><figcaption></figcaption></figure>

Try to minimize **Count** property. Higher this value is, the more expensive is mask calculation.&#x20;

Also try using the **Simple** type mask instead of the **Advanced**. Simple mask uses less instruction, but doesn't support Smoothing and Noise visual features.

***

#### **Clever choose required mask count**

If using **DRM Live objects**, always check their generated count inside the **DRM Controller**. This helps to analyze how many DRM objects the shader effect really needs:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FAxrXOMBy4hmUsNH0gxRR%2F1.gif?alt=media&#x26;token=45f82fc9-def6-4cc8-b34c-c31c85ee588e" alt="" width="294"><figcaption></figcaption></figure>

***

#### Use keywords

Control DRM node calculation using keywords. For example if creating bullet holes effect, there will be moments when there just aren't any bullet holes to render, but the DRM node (or method) still will keep its calculation. In this case DRM calculation can be disabled by a keyword and enabled only when it is required.&#x20;

Keywords can be manually [enabled](https://docs.unity3d.com/ScriptReference/Material.EnableKeyword.html) and [disabled](https://docs.unity3d.com/ScriptReference/Material.DisableKeyword.html), but **DRM Controller** already has the feature for automatically enabling keywords when the very first object is added to the Pool and disables them when Pool becomes empty:

<figure><img src="https://1494537888-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVDsGRBXgFisq0hO6tTXv%2Fuploads%2FEPTLpB6xkSiPSVwgx5RC%2F41.png?alt=media&#x26;token=5bd6c61a-8fae-448e-a707-f1c406a6973a" alt=""><figcaption></figcaption></figure>
