another TLSF vs realloc-pool shootout
authorRobin Gareus <robin@gareus.org>
Tue, 19 Jul 2016 13:06:20 +0000 (15:06 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 19 Jul 2016 13:06:20 +0000 (15:06 +0200)
..since memory-size and segmentation increased.
(large sizes favor TLSF, smaller segments are in favor realloc-pool)

libs/ardour/ardour/luaproc.h
libs/ardour/luaproc.cc

index cc7c1e1e5d78dd0bedd57ec724012086db6d76a8..e5c6d157353d2e200f1301047352baea5ba81b8c 100644 (file)
@@ -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__
 
 #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;
index 54427a2ddb8ea76b62aa55ca14422bd519684f82..40dcf9e8bb429a1e37d9b8ac849785b0156611a1 100644 (file)
@@ -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)