Re: Performance luabind vs. SWIG

Bjorn Toft Madsen <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <FE474048365839429685518F5A5511171DA0DA@DB3EX14MBXC309.europe.corp.microsoft.com>
Allow me to clarify: The a-priori reasoning that "LuaBind is too slow" exists within my organization, rightly or wrongly. Wasn't trying to imply this to be a globally held view. Also, I'm a big LuaBind-fan, so I'm looking for arguments to get my colleagues to re-evaluate their decisions, not trying to put LuaBind down :)

-----Original Message-----
From: Bjorn Toft Madsen [mailto:[email protected]] 
Sent: 30 November 2009 09:30
To: [email protected]
Subject: Re: [luabind] Performance luabind vs. SWIG

I've worked on several teams within my company that have rejected LuaBind on reasons of performance, so it would be terribly handy if these benchmarks were made part of the public source, or at least made available in some way. That way, at least there'd be a counter-argument when the, by now a-priori, reasoning goes that "LuaBind is too slow". If nothing else, it would give us a shared metric to talk about ("why is LuaBind faster/slower here? Why does/doesn't it matter?")

LuaBind has by far the nicest syntax but cleanliness/syntax just doesn't matter when you cannot afford to lose FPS.

Thanks,
Bjorn

-----Original Message-----
From: Daniel Wallin [mailto:[email protected]] 
Sent: 28 November 2009 22:02
To: [email protected]
Subject: Re: [luabind] Performance luabind vs. SWIG

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
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
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
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.