Java Mailing List Archive

Home » the NHibernate development list »

Re: [NHibernate-development] Nhibernate-development Digest, Vol 28,
 Issue 8

Johan Kirsten


Replies: Find Java Web Hosting

Author LoginPost Reply
Hi Andrew

Unfortunately the theory is different from the practice. I have investigated
this matter

Basically the problem is that NHibernate compiles the proxy each time and
every time it needs to instantiate the proxy. i.e for each constructor call
there is a preceding compilation of the proxy. It does not get cached.
Please refer to the class NHibernate.Proxy.Poco.Castle.CastleProxyFactory.

Your options are:
1) change NHibernate.Proxy.Poco.Castle.CastleProxyFactory to cache its proxy
type as in the link above
2) use compile time proxies.

If option 1 is used, then your theory is correct. I prefer to use compile
time proxies as I want my users not to have unnecessary delays. The more I
can move to compile time or start up the better. I tried to move the
compilation of all my run time proxies to startup by altering
NHibernate.Proxy.Poco.Castle.CastleProxyFactory, but that took too long and
used a lot of memory. I have a complicated system with a lot of types. Hence
I prefer compile time proxies. Other people might prefer option 1. I think
people should be given a choice.

Best regards

Johan Kirsten

> ------------------------------
> Message: 2
> Date: Thu, 4 Sep 2008 11:39:24 +0400
> From: "Andrew Mayorov" <xor@(protected)>
> Subject: Re: [NHibernate-development] Speed improvement using compile
> time generated proxies
> To: "'the NHibernate development list'"
> <nhibernate-development@(protected)>
> Message-ID: <037101c90e61$5dae9970$190bcc50$@(protected)>
> Content-Type: text/plain; charset="us-ascii"
> Hi!
> Guys, can anyone explain why precompiled proxy could be faster than
> runtime
> generated in real application? Proxy generation should be one time
> operation
> for each type, and as soon as we've made a proxy for particular type there
> should be no difference in method of its creation. Yes, first query with
> precompiled proxy would execute faster, but all subsequent should have the
> same speed.
> Best,
> Andrew

This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Nhibernate-development mailing list
©2008 - Jax Systems, LLC, U.S.A.