Question about performance when referencing #thisContext

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about performance when referencing #thisContext

G Krupa-2
All,

What (if any) performance hit can I expect by referencing #thisContext in a
method?  It seems to resolve to an integer, so I'm guessing it's just a
special byte code operation or primitive.  Or does it force the VM to do
some stuff it wouldn't otherwise and mess up the "flow" of things?

I was once told that #thisContext would generate the objects on the fly
(that is, the VM didn't have them handy), and wasn't a recommended practice.
Is this just true with some (other) VMs?

Cheers,

--GK


Reply | Threaded
Open this post in threaded view
|

Re: Question about performance when referencing #thisContext

Blair McGlashan
"G Krupa" <[hidden email]> wrote in message
news:[hidden email]...
> All,
>
> What (if any) performance hit can I expect by referencing #thisContext in
a
> method?  It seems to resolve to an integer, so I'm guessing it's just a
> special byte code operation or primitive.  Or does it force the VM to do
> some stuff it wouldn't otherwise and mess up the "flow" of things?

There is no performance hit in Dolphin.

>
> I was once told that #thisContext would generate the objects on the fly
> (that is, the VM didn't have them handy), and wasn't a recommended
practice.
> Is this just true with some (other) VMs?

It is implementation dependent. On some implementations refererencing
thisContext may cause the stack of logical activation records, or part of
it, to be reified into heap objects. In Dolphin thisContext just resolves to
an address in the Process stack at which the current activation record
starts. This address can be used in conjunction with the StackFrame
abstraction to access and manipulate the Process stack, as exemplified by
the Debugger.

Regards

Blair