Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

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

Ayende Rahien

2008-09-04

Replies: Find Java Web Hosting

Author LoginPost Reply
The Dynamic Proxy implementation is caching types already internally.

On Thu, Sep 4, 2008 at 4:33 AM, Andrew Mayorov <xor@byte-force.com> wrote:
Johan,

I agree about ability to make a choice. BTW, we use NH in web environment,
so a little bigger delay in startup doesn't matter. For us it's more
important to be able to add new types w/o recompilation of all package, so
precompiled proxies doesn't seem as good solution.

Anyway, I think that stock implementation of proxy generator should be
modified in a way you've described - it should cache types. There are very
little efforts necessary for this, while bonus is obvious.

Best,
Andrew

> -----Original Message-----
> From: nhibernate-development-bounces@lists.sourceforge.net
> [mailto:nhibernate-development-bounces@lists.sourceforge.net] On Behalf
> Of Johan Kirsten
> Sent: Thursday, September 04, 2008 12:09 PM
> To: nhibernate-development@lists.sourceforge.net
> Subject: Re: [NHibernate-development] Nhibernate-development Digest,
> Vol 28, Issue 8
>
> Hi Andrew
>
> Unfortunately the theory is different from the practice. I have
> investigated
> this matter
> (http://groups.google.com/group/nhibernate-
> development/browse_thread/thread/90b9e4feca7c3552)
>
> 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@byte-force.com>
> > Subject: Re: [NHibernate-development] Speed improvement using compile
> > time generated proxies
> > To: "'the NHibernate development list'"
> > <nhibernate-development@lists.sourceforge.net>
> > Message-ID: <037101c90e61$5dae9970$190bcc50$@com>
> > 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
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Nhibernate-development mailing list
> Nhibernate-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nhibernate-development


-------------------------------------------------------------------------
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
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development

-------------------------------------------------------------------------
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
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.