# Optimizing

The code optimization in the synthesis phase is a program transformation technique, which tries to improve the intermediate code by making it consume fewer resources (i.e. CPU, Memory) so that faster-running machine code will result. Our State of the art Optimization feature will target the optimization of various activities such as Loop Unrolling, Instruction Scheduling, Register Allocation, and Dead Code elimination.&#x20;

The optimization process will be performed to improve the performance of the application by reducing the overall execution time, memory usage, and power consumption.

### Step 1 :

Log in first with Google Authentication on Kodezi.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FdTYQfAmfu4j93MWL6Okq%2FStep%2003%20(1).png?alt=media&#x26;token=e5c4f5b8-4dff-4e3c-9225-ecb84b56026f" alt=""><figcaption></figcaption></figure>

### Step 2 :

After successfully logging in, select the Optimizing button for the short method, or use the context menu when right-clicking the code editor.

<div><figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FftbxjqdAvfFRvaLSdISI%2FFrame%2055940%20(1).png?alt=media&#x26;token=4a38c493-ab52-4fd3-8e52-4c986da657de" alt=""><figcaption><p>Kodezi Quick Explorer</p></figcaption></figure> <figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FzBD02ifIGXbbQiVyacl2%2FFrame%2055942.png?alt=media&#x26;token=a3e7ea61-d139-4a52-9a5c-7b14c79cf03a" alt=""><figcaption><p>Visual Studio Code Context Menu</p></figcaption></figure></div>

{% hint style="warning" %}
At this time optimizing large amounts of code simultaneously is not supported. We recommend choosing a specific block of code to optimize instead.&#x20;
{% endhint %}

### Step 3 :

After clicking on the optimizing button, the optimizing process will start.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FzHMwkBCGJIijTMbPwiwd%2Foptimizing3.png?alt=media&#x26;token=429a7fa4-97a9-4bcc-a624-42164a5b2bca" alt=""><figcaption></figcaption></figure>

### Step 4 :

You will see results similar to these in your IDE once the optimizing process is finished.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FFywcne9nbysilcTdAwAa%2FGenerate%20Documentation%20Select%20Type%20(1).png?alt=media&#x26;token=973f4cb9-08a2-4382-8456-1ef592805fd1" alt=""><figcaption></figcaption></figure>

### Step 5 :

Now you can simply click on the apply button for the result that will add to your original file.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kodezi.com/feature-guides/optimizing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
