-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance issue while iterating over a table of tables #318
Comments
In the module mode there are some overhead related to safety checks (eg succesfull memory allocations and so on).
But I'm not surprised that Lua VM is faster in this particular case becase mlua uses public Lua API but Lua VM uses much faster private api bypassing some overhead. |
Thank you for your response, Is it possible to add a memory pool to reuse allocations for mlua? do you believe that we have any other solution? Is it possible to achieve the performance of serialization for example CJSON with mlua using only safe code? |
I'll look into it. But not in module more, in this case mlua does not control lua vm allocations.
I hope so. Optimizing serialization performance was not yet in my focus, but I'll look into it now. There are definitely some options that can (significantly) improve (tables) serialization performance. |
Hi, I was trying to benchmark mlua to see what gain I can achieve by moving some of the logic of my program to mlua so I wrote this test:
I wrote this Lua code to benchmark it:
And i got this result:
This means Rust code is doing the same task 14 times slower than Lua code.
I wonder what caused that, I'm not really familiar with Lua internals. so I can't say if it's a bug or not.
Target Lua version: Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
Rust version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
The text was updated successfully, but these errors were encountered: