Re: Performance luabind vs. SWIG
Daniel Wallin <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Sebastian Wolff wrote:
> This is quite astonishing since I thought that template magic may be
> able to speed up things. I did not use any special -D's, luabind was
> used as provided by my vendor (opensuse x64).
>
> I only wanted the list you know this. Maybe someone picks it up to
> finde some room for improvement in luabind.
Things have improved a lot for 0.9. On my system, for your benchmark, I get:
SWIG 7.3s
luabind 0.8.1 14.5s
luabind 0.9 10.5s
I haven't looked to closely at the differences, but here are some things
that probably contributes:
1. luabind does more than SWIG when dispatching operators. SWIG
basically just stuffs a function directly in the metatable, luabind
has an extra level of indirection here.
2. luabind does more than SWIG when constructing an object. It mostly
comes from having a more complex object system. Doing:
x = Someclass()
will just drop right into the construction function in SWIG. With
luabind we get one, at least, extra level of indirection because
construction of the object holder is separated from initialization.
In theory, at least, we could complicate the implementation to
eliminate this when directly constructing an instance of a C++
class. I'm inclined not though, because I want to keep the
implementation reasonably clean.
Although this particular case shows quite a difference between luabind
and SWIG, I believe in general the differences are much smaller. I keep
my own benchmark suite, which shows luabind 0.9 being equal to SWIG in
most cases.
--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july