> For the complete documentation index, see [llms.txt](https://pellix-1.gitbook.io/pellix-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pellix-1.gitbook.io/pellix-docs/performance-guidelines.md). Agents can also search and read this documentation through its [MCP server](https://pellix-1.gitbook.io/pellix-docs/~gitbook/mcp).

# Performance guidelines

This page contains information about performance tips and tricks that you can use in your code to improve overall performance of your Lua script.

In our Lua API we expose our API functions in the following format:

<pre class="language-lua"><code class="lang-lua"><strong>_G[group] = table
</strong></code></pre>

\_G is a global table which you index every time when you use your call to our API.

If you cache API function that you want to use locally in your script it will prevent Lua from indexing global table for the group, then indexing group table for the table entry, which is a slower operation than local variable access.

This can be done like this:

```lua
local draw_line = draw.line
draw_line(...)
```
