[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Did they mean "." or ":"?
- From: Christopher Eykamp <chris@...>
- Date: Thu, 18 Feb 2010 15:00:10 -0800
On 2/17/2010 1:56 PM, Wesley Smith wrote:
Thanks for posting that, wes. Analyzing what you were doing helped my
understand another poster's comments about shared functions and the
overhead incurred by using this approach. In some situations it is
probably not a big deal. In Bitfighter, some objects have 50 or so
methods (and counting), and, in many cases, may be created and deleted
within a single frame, so I could easily see having to create 500 or
more "customized" methods 50 times per second, which might start
incurring some overhead.
If you wouldn't mind, I'd like to see a sample. Your approach may work
better for me than some of the other proposals here because I'm using Lunar
to do my binding, and I do not have direct access to the object without
modifying Lunar, which I'd prefer not to do.
I did something similar to emulate OpenGL calls with Cairo graphics.
Cairo requires an object to draw with whereas in OpenGL the state
machine lives outside of the library. If you look at line 260 of this
file, you'll see the for loop that transforms instance methods to
In a situation like the one I imagine you have, there is a single object
that needs to be "wrapped", with a limited number of methods.
Therefore, for you, the overhead is essentially 0.