Performance optimization #493
sraimond83
started this conversation in
Show and tell
Replies: 1 comment
-
Is there any way to at least to reuse the .LoadString() part? Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear all,
I manage a software application that relies on custom scripts created by end users to handle real-time data from various connectors. This approach has worked well so far. However, recently, a user has started using a very large script (2500+ lines), which is beginning to strain the server CPU.
The script runs approximately 5-10 times per second, leading to increased CPU usage and more frequent garbage collection.
Here's a screenshot of the overall CPU profile for a minute of activity.
You can see that script parsing and compiling take the same amount of time as running the script. Additionally, there's a significant amount of garbage collection, which would be reduced by 80% if no Lua script were running (I've already run some tests to confirm this).
I would like to optimize this process if possible. The script is always the same, meaning its source never changes. However, each custom function implemented returns data dynamically, which is passed before the
.DoString(...)
function is called, based on the incoming data from the inbound connector that my application handles.Is there a way to reuse the Lua code/VM without going through compilation each time and to generate less garbage to be collected?
Advice is welcome,
thank you!
Beta Was this translation helpful? Give feedback.
All reactions