[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re[2]: Best way to find out to what userdata is on the stack?
- From: Lothar Scholz <mailinglists@...>
- Date: Tue, 13 Mar 2007 19:28:51 -0800
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