lua-users home
lua-l archive

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





From: Ando Sonenblick <ando@spritec.com>
Reply-To: Lua list <lua@bazar2.conectiva.com.br>
To: Lua list <lua@bazar2.conectiva.com.br>
Subject: Re: Performance question
Date: Sun, 28 Sep 2003 17:48:39 -0700

True enough....

But, perhaps I'm misunderstanding something (not yet having looked into refs - hey, it's the weekend) but this is my understanding of them based on these email exchanges.

Say I have a global variable named "foo".

If I'm accessing it a lot (from C++ that is) by name, doesn't every access go thru a string compare look up in the global table? And isnt it the case that if I make a reference to that variable and use that for my access, there will no longer be a string compare?

Is there still a ref look up? Or is it a direct value (such as a ptr or index, etc)?

I would take a guess and say that from the fact that the luaregistry is a table, and refs are numbers, that to get a ref you need simply access the ref index of that that table. This is just my conjecture. If so, then it should be quite a bit
faster than pushing the string over and over to access the variable.

Maybe its time to write a little performance test application...

_________________________________________________________________
Instant message in style with MSN Messenger 6.0. Download it now FREE! http://msnmessenger-download.com