Skip to content
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

Why sol3 is slower than Luabridge3 when both using LuaJIT, #1600

Open
qiuxinyun2010 opened this issue Apr 27, 2024 · 1 comment
Open

Why sol3 is slower than Luabridge3 when both using LuaJIT, #1600

qiuxinyun2010 opened this issue Apr 27, 2024 · 1 comment

Comments

@qiuxinyun2010
Copy link

qiuxinyun2010 commented Apr 27, 2024

The test case is to sum to 10000000.

execution time:

  • C++ native: 6ms
  • Sol3.3.1 + lua5.4.4: 253ms
  • LuaBridege3 + lua5.4.4: 284ms
  • Sol3.3.1 + luajit2.0.5: 56ms
  • LuaBridege3 + luajit2.0.5: 7ms
lua.script(R"(
        x = 0;
        for i = 1, 10000000 do
            x = x+i;
        end
 )");
// sol took 56 ms
// luabridge took 7ms

int x = 0;
for (auto i = 0; i < 10000000; i++)
{
  x0 += i;
}
// took 6ms
@hfn92
Copy link

hfn92 commented Apr 30, 2024

did you load the jit module with lua.open_libraries(sol::lib::jit)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants