summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-07-19 15:06:20 +0200
committerRobin Gareus <robin@gareus.org>2016-07-19 15:06:20 +0200
commitcf89f645ab4a7fae37abd0241c02203353f359ff (patch)
treef5f4ddbc1c4374d38b731b5811c47b7d8f825bc7
parentc1aef0084af55104f16fa80f71d98df4d77fcbc7 (diff)
another TLSF vs realloc-pool shootout
..since memory-size and segmentation increased. (large sizes favor TLSF, smaller segments are in favor realloc-pool)
-rw-r--r--libs/ardour/ardour/luaproc.h14
-rw-r--r--libs/ardour/luaproc.cc8
2 files changed, 21 insertions, 1 deletions
diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h
index cc7c1e1e5d..e5c6d15735 100644
--- a/libs/ardour/ardour/luaproc.h
+++ b/libs/ardour/ardour/luaproc.h
@@ -17,6 +17,9 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
+//#define WITH_LUAPROC_STATS
+//#define USE_TLSF
+
#ifndef __ardour_luaproc_h__
#define __ardour_luaproc_h__
@@ -24,7 +27,12 @@
#include <vector>
#include <string>
-#include "pbd/reallocpool.h"
+#ifdef USE_TLSF
+# include "pbd/tlsf.h"
+#else
+# include "pbd/reallocpool.h"
+#endif
+
#include "pbd/stateful.h"
#include "ardour/types.h"
@@ -121,7 +129,11 @@ protected:
const std::string& script() const { return _script; }
private:
+#ifdef USE_TLSF
+ PBD::TLSF _mempool;
+#else
PBD::ReallocPool _mempool;
+#endif
LuaState lua;
luabridge::LuaRef * _lua_dsp;
std::string _script;
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index 54427a2ddb..40dcf9e8bb 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -47,7 +47,11 @@ LuaProc::LuaProc (AudioEngine& engine,
const std::string &script)
: Plugin (engine, session)
, _mempool ("LuaProc", 2097152)
+#ifdef USE_TLSF
+ , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool))
+#else
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
+#endif
, _lua_dsp (0)
, _script (script)
, _lua_does_channelmapping (false)
@@ -71,7 +75,11 @@ LuaProc::LuaProc (AudioEngine& engine,
LuaProc::LuaProc (const LuaProc &other)
: Plugin (other)
, _mempool ("LuaProc", 2097152)
+#ifdef USE_TLSF
+ , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool))
+#else
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
+#endif
, _lua_dsp (0)
, _script (other.script ())
, _lua_does_channelmapping (false)