added performance guide

This commit is contained in:
2025-10-12 03:03:18 -06:00
parent 5065d5d788
commit 0b2fc6f495

View File

@@ -0,0 +1,67 @@
---
weight: 999
title: "Performance Guide"
description: "Performance guide for MoonVeil"
icon: "article"
date: "2025-05-01T18:47:58-05:00"
lastmod: "2025-05-01T18:47:58-05:00"
---
MoonVeil provides multiple solutions to improve and optimize the performance of your scripts.
## Using the 'Fast VM' option
This preset is available in [your dashboard's settings](/docs/dashboard/). If you're still having performance issues, continue reading.
## Omitting Obfuscation from blocks
Not all code needs to be obfuscated. Large libraries that deal with unimportant code such as UI libraries, data serialization libraries, etc. can be left unobfuscated.
MoonVeil allows you to omit obfuscation from specific blocks of your script, by wrapping the block in an `MV_OMIT` macro:
```lua
MV_OMIT(function()
for i = 0, 10 do
print(i)
end
end)()
```
Code that runs frequently (e.g. per game tick, render frame, or otherwise multiple times per second) may cause application freezes, drop FPS, reduce throughput, and increase latency even if optimized properly. Most of the time obfuscation is not necessary on these functions. For example:
```lua
game:GetService("RunService").RenderStepped:Connect(MV_OMIT(function()
Label.Text = "FPS: " .. game:GetService("Stats").FramesPerSecond
-- or whatever
end))
```
## Obfuscation only through macros
Who says you need to obfuscate your whole script? If you know what you're doing, you can selectively tell MoonVeil to **only** obfuscate certain parts of your script using the `MV_VM`, `MV_ENC_FUNC` and `MV_CFF` macros. This gives you much more control over the obfuscation process, you simply tell MoonVeil what parts of your script you want to obfuscate:
```lua
local getThing = MV_VM(function()
for i = 0, 10 do
print(i)
end
-- this will be SO slow, but does work!
MV_CFF(function()
for i = 0, 10 do
print(i)
end
end)()
return "hello world"
end)
MV_ENC_FUNC(function()
print('yay function unencrypted')
for i = 0, 10 do
print(i)
end
end, "hello world", getThing())()
```
Then using the `Minify` preset will only run the passes you've specified. For a full list of macros, see the [documentation](/docs/macros).