From 2fa6314fb44f5136ce726408dc907dc5ff3b6cea Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 19 Mar 2018 02:26:24 +0100 Subject: Lua: Lock bindings into memory for rt-scripts Empirically this decreases gc-spike duration (worst-case) by a factor of two and speeds up the average gc-run by a factor of over 4 (depending on the amount of memory used by the plugin). --- libs/ardour/session.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libs/ardour/session.cc') diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 039288952b..6d2ca75719 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -5486,7 +5486,7 @@ Session::try_run_lua (pframes_t nframes) Glib::Threads::Mutex::Lock tm (lua_lock, Glib::Threads::TRY_LOCK); if (tm.locked ()) { try { (*_lua_run)(nframes); } catch (...) { } - lua.collect_garbage_step (100 /*kB*/); + lua.collect_garbage_step (); } } @@ -5496,7 +5496,6 @@ Session::setup_lua () #ifndef NDEBUG lua.Print.connect (&_lua_print); #endif - lua.tweak_rt_gc (); lua.sandbox (true); lua.do_command ( "function ArdourSession ()" @@ -5627,9 +5626,11 @@ Session::setup_lua () abort(); /*NOTREACHED*/ } + lua_mlock (L, 1); LuaBindings::stddef (L); LuaBindings::common (L); LuaBindings::dsp (L); + lua_mlock (L, 0); luabridge::push (L, this); lua_setglobal (L, "Session"); } -- cgit v1.2.3