Re: Nhibernate-development Digest, Vol 28, Issue 8

"Jesse Napier" <[email protected]> Thu, 4 Sep 2008 15:17:35 -0700
Newsgroups gmane.comp.windows.dotnet.nhibernate.devel
Message-ID <ADDDC70391998C4887386EB544F2600202A4A7E5@gfexchange01.gfhome.gamefly.com>
This is a multi-part message in MIME format.

--===============0689608096==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C90EDC.09467001"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C90EDC.09467001
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I ran some performance test using the static proxy generator and I
didn't see any improvement what so ever after startup.  Since castle
dynamic proxy caches the proxy this is what I expected.

=20

________________________________

From: [email protected]
[mailto:[email protected]] On Behalf
Of Ayende Rahien
Sent: Thursday, September 04, 2008 4:32 AM
To: the NHibernate development list
Subject: Re: [NHibernate-development] Nhibernate-development Digest, Vol
28,Issue 8

=20

The Dynamic Proxy implementation is caching types already internally.

On Thu, Sep 4, 2008 at 4:33 AM, Andrew Mayorov <[email protected]>
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: [email protected]
> [mailto:[email protected]] On
Behalf
> Of Johan Kirsten
> Sent: Thursday, September 04, 2008 12:09 PM
> To: [email protected]
> 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" <[email protected]>
> > Subject: Re: [NHibernate-development] Speed improvement using
compile
> > time generated proxies
> > To: "'the NHibernate development list'"
> > <[email protected]>
> > Message-ID: <037101c90e61$5dae9970$190bcc50$@com>
> > Content-Type: text/plain; charset=3D"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=3D100&url=3D/
> _______________________________________________
> Nhibernate-development mailing list
> [email protected]
> 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=3D100&url=3D/
_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development

=20


------_=_NextPart_001_01C90EDC.09467001
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dblue>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>I ran some performance test using =
the static
proxy generator and I didn&#8217;t see any improvement what so ever =
after startup.&nbsp;
Since castle dynamic proxy caches the proxy this is what I =
expected.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>

<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>

</span></font></div>

<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font =
size=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>
[email protected]
[mailto:[email protected]] <b><span
style=3D'font-weight:bold'>On Behalf Of </span></b>Ayende Rahien<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Thursday, September =
04, 2008
4:32 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> the NHibernate =
development
list<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> Re:
[NHibernate-development] Nhibernate-development Digest, Vol 28,Issue =
8</span></font><o:p></o:p></p>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>The Dynamic =
Proxy
implementation is caching types already =
internally.<o:p></o:p></span></font></p>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>On Thu, Sep 4, 2008 at 4:33 AM, Andrew Mayorov &lt;<a
href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>Johan,<br>
<br>
I agree about ability to make a choice. BTW, we use NH in web =
environment,<br>
so a little bigger delay in startup doesn't matter. For us it's more<br>
important to be able to add new types w/o recompilation of all package, =
so<br>
precompiled proxies doesn't seem as good solution.<br>
<br>
Anyway, I think that stock implementation of proxy generator should =
be<br>
modified in a way you've described - it should cache types. There are =
very<br>
little efforts necessary for this, while bonus is obvious.<br>
<br>
Best,<br>
<font color=3D"#888888"><span =
style=3D'color:#888888'>Andrew</span></font><o:p></o:p></span></font></p>=


<div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><br>
&gt; -----Original Message-----<br>
&gt; From: <a =
href=3D"mailto:[email protected]">nhib=
[email protected]</a><br>
&gt; [mailto:<a
href=3D"mailto:[email protected]">nhib=
[email protected]</a>]
On Behalf<br>
&gt; Of Johan Kirsten<br>
&gt; Sent: Thursday, September 04, 2008 12:09 PM<br>
&gt; To: <a =
href=3D"mailto:[email protected]">nhibernate-d=
[email protected]</a><br>
&gt; Subject: Re: [NHibernate-development] Nhibernate-development =
Digest,<br>
&gt; Vol 28, Issue 8<br>
&gt;<br>
&gt; Hi Andrew<br>
&gt;<br>
&gt; Unfortunately the theory is different from the practice. I have<br>
&gt; investigated<br>
&gt; this matter<br>
&gt; (<a href=3D"http://groups.google.com/group/nhibernate-" =
target=3D"_blank">http://groups.google.com/group/nhibernate-</a><br>
&gt; development/browse_thread/thread/90b9e4feca7c3552)<br>
&gt;<br>
&gt; Basically the problem is that NHibernate compiles the proxy each =
time<br>
&gt; and<br>
&gt; every time it needs to instantiate the proxy. i.e for each =
constructor<br>
&gt; call<br>
&gt; there is a preceding compilation of the proxy. It does not get =
cached.<br>
&gt; Please refer to the class<br>
&gt; NHibernate.Proxy.Poco.Castle.CastleProxyFactory.<br>
&gt;<br>
&gt; Your options are:<br>
&gt; 1) change NHibernate.Proxy.Poco.Castle.CastleProxyFactory to cache =
its<br>
&gt; proxy<br>
&gt; type as in the link above<br>
&gt; 2) use compile time proxies.<br>
&gt;<br>
&gt; If option 1 is used, then your theory is correct. I prefer to =
use<br>
&gt; compile<br>
&gt; time proxies as I want my users not to have unnecessary delays. =
The<br>
&gt; more I<br>
&gt; can move to compile time or start up the better. I tried to move =
the<br>
&gt; compilation of all my run time proxies to startup by altering<br>
&gt; NHibernate.Proxy.Poco.Castle.CastleProxyFactory, but that took too =
long<br>
&gt; and<br>
&gt; used a lot of memory. I have a complicated system with a lot of =
types.<br>
&gt; Hence<br>
&gt; I prefer compile time proxies. Other people might prefer option 1. =
I<br>
&gt; think<br>
&gt; people should be given a choice.<br>
&gt;<br>
&gt; Best regards<br>
&gt;<br>
&gt; Johan Kirsten<br>
&gt;<br>
&gt; &gt; ------------------------------<br>
&gt; &gt;<br>
&gt; &gt; Message: 2<br>
&gt; &gt; Date: Thu, 4 Sep 2008 11:39:24 +0400<br>
&gt; &gt; From: &quot;Andrew Mayorov&quot; &lt;<a
href=3D"mailto:[email protected]">[email protected]</a>&gt;<br>
&gt; &gt; Subject: Re: [NHibernate-development] Speed improvement using =
compile<br>
&gt; &gt; time generated proxies<br>
&gt; &gt; To: &quot;'the NHibernate development list'&quot;<br>
&gt; &gt; &lt;<a =
href=3D"mailto:[email protected]">nhibernate-d=
[email protected]</a>&gt;<br>
&gt; &gt; Message-ID: &lt;037101c90e61$5dae9970$190bcc50$@com&gt;<br>
&gt; &gt; Content-Type: text/plain; charset=3D&quot;us-ascii&quot;<br>
&gt; &gt;<br>
&gt; &gt; Hi!<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Guys, can anyone explain why precompiled proxy could be faster =
than<br>
&gt; &gt; runtime<br>
&gt; &gt; generated in real application? Proxy generation should be one =
time<br>
&gt; &gt; operation<br>
&gt; &gt; for each type, and as soon as we've made a proxy for =
particular type<br>
&gt; there<br>
&gt; &gt; should be no difference in method of its creation. Yes, first =
query<br>
&gt; with<br>
&gt; &gt; precompiled proxy would execute faster, but all subsequent =
should<br>
&gt; have the<br>
&gt; &gt; same speed.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Best,<br>
&gt; &gt;<br>
&gt; &gt; Andrew<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; =
-----------------------------------------------------------------------<b=
r>
&gt; --<br>
&gt; This SF.Net email is sponsored by the Moblin Your Move =
Developer's<br>
&gt; challenge<br>
&gt; Build the coolest Linux based applications with Moblin SDK &amp; =
win great<br>
&gt; prizes<br>
&gt; Grand prize is a trip for two to an Open Source event anywhere in =
the<br>
&gt; world<br>
&gt; <a =
href=3D"http://moblin-contest.org/redirect.php?banner_id=3D100&amp;url=3D=
/"
target=3D"_blank">http://moblin-contest.org/redirect.php?banner_id=3D100&=
amp;url=3D/</a><br>
&gt; _______________________________________________<br>
&gt; Nhibernate-development mailing list<br>
&gt; <a =
href=3D"mailto:[email protected]">Nhibernate-d=
[email protected]</a><br>
&gt; <a
href=3D"https://lists.sourceforge.net/lists/listinfo/nhibernate-developme=
nt"
target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/nhibernate=
-development</a><br>
<br>
<br>
-------------------------------------------------------------------------=
<br>
This SF.Net email is sponsored by the Moblin Your Move Developer's =
challenge<br>
Build the coolest Linux based applications with Moblin SDK &amp; win =
great
prizes<br>
Grand prize is a trip for two to an Open Source event anywhere in the =
world<br>
<a =
href=3D"http://moblin-contest.org/redirect.php?banner_id=3D100&amp;url=3D=
/"
target=3D"_blank">http://moblin-contest.org/redirect.php?banner_id=3D100&=
amp;url=3D/</a><br>
_______________________________________________<br>
Nhibernate-development mailing list<br>
<a =
href=3D"mailto:[email protected]">Nhibernate-d=
[email protected]</a><br>
<a =
href=3D"https://lists.sourceforge.net/lists/listinfo/nhibernate-developme=
nt"
target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/nhibernate=
-development</a><o:p></o:p></span></font></p>

</div>

</div>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

</body>

</html>

------_=_NextPart_001_01C90EDC.09467001--


--===============0689608096==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
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=/
--===============0689608096==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development

--===============0689608096==--