lua-users home
lua-l archive

Re[2]: Best way to find out to what userdata is on the stack?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello Luiz,
>> At the moment i'm using an hash table for all my own userdata,
>> lookup the pointer there and if found i get a verification that this
>> userdata is really a "Foobar" struct.
LHdF> This is one way, yes. But I hope you're using a Lua table for that, not
LHdF> your own hash table...
No a lua table would be too much overhead.
LHdF> For another way, see http://www.lua.org/pil/28.html , especially section 28.2.
LHdF> --lhf
But this requires first a hash lookup in the string table and then a
hash lookup in the registry if i haven't missed some optimizations. I
know that only one hash value needs to be generated but there are much
more memory accesses and jumps (CPU pipeline stalls) when doing this.
So i really doubt that i win anything (the current implementation already
works), sure if i would have read the manual more precisely in the
beginning .... But now my time for implementation/testing is already
wasted.
-- 
 Best regards, emailto: scholz at scriptolutions dot com
 Lothar Scholz http://www.ruby-ide.com
 CTO Scriptolutions Ruby, PHP, Python IDE 's
 

AltStyle によって変換されたページ (->オリジナル) /