Jruby JIT question

Let’s say I have a pair of objects setup in a publish-subscribe
manner. Object A communicates to Object B by creating and sending a
new instance of class C for every publish.

class A
include Observable

def publish
changed
notify_observers(C.new(some_data))
end
end

class B
def update(message)
# do something with message
end
end

class C
def initialize(data)
long_and_complex_computation(data)
end
end

In this scenario, class C’s constructor is called every time a new
message is sent (could be many thousands of times). Is it ever JIT’ed
even though it only gets called once per object?

cr


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

The JIT counter is actually on the interpreted version of the method.
So regardless of which object is calling the method, once that method
has been called enough times it tries to JIT the method. So it should
JIT in this scenario.

-Tom

On Wed, Aug 27, 2008 at 9:40 PM, Chuck R. [email protected]
wrote:

end
long_and_complex_computation(data)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thomas & Peter,

thanks for your replies. I was worried that it compiled based on
instances rather than classes, but your responses have clarified that
issue.

Now if only the mailing list didn’t have a 10 to 20 hour delay in
posting new messages…

cr

On Aug 28, 2008, at 2:07 PM, Peter K Chan wrote:

new instance of class C for every publish.
class B

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

If it keeps up let us know again and we’ll lean on Codehaus.

Chuck R. wrote:

new instance of class C for every publish.
class B

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I don’t see why the C constructor wouldn’t be JIT compiled. Most JIT
compilers, that I know of, compiles on the basis of classes, not object
instances.

This is, of course, assuming that you don’t constantly redefine
C#initialize
or that long_and_complex_computation does not execute any dynamic string
evals.

Peter