[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: On lua5 and embedding
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 29 Jan 2003 09:07:47 +0000
> A TAG wrapper around lua5's userdata could be handy in porting
> lua4 applications to lua5. But a hack is hack, no matter
> how clever it is. At least for me, I don't see much advantage
> in doing so. Extra wrapper for thousands of userdata used
> in my program could be a serious overhead.
> The real question is, can lua5 be improved to deal with
> heavy-weight userdata without using Lua's own malloc?
Maybe what is not very clear is that Lua 4.0 did that too. Everytime you
pushed a new userdata in Lua 4.0 it created a wrapper for your pointer,
exactly as Lua 5.0 does. But that creation was hidden from the user. Lua
5.0 only makes things more explicit: if you want a wrapper, you create
the wrapper. Another difference is that Lua 4.0 would coalesce a new
userdata into an old one if they have the same value. Lua 5.0 does not
do that, but it is easy to do that yourself if that is what you want
(that is what light userdata are for); and you do not have to do it
(and pay the price) if you do not need/want it.
Frequently the problem is not performance, but the perception people
have about performance.