<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx</link><description>Creating an XmlSerializer has a well-known performance cost since .net will generate a temporary helper assembly which requires a compiler call. Additionally, the assembly cannot be unloaded without unloading the hosting application domain causing high</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx#9407351</link><pubDate>Sun, 08 Feb 2009 22:57:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9407351</guid><dc:creator>UK</dc:creator><description>&lt;p&gt;You can find a tutorial on how to create the XmlSerializers for the crm web service manually on my blog.&lt;/p&gt;</description></item><item><title>re: Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx#9410817</link><pubDate>Tue, 10 Feb 2009 19:26:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9410817</guid><dc:creator>goruiz</dc:creator><description>&lt;p&gt;I find your tutorial very useful, I was not expecting to see such a huge benefit! (~12 seconds in your case).&lt;/p&gt;
&lt;p&gt;Unfortunatelly you'd have to generate your own CrmService proxy which has the disadvantages you pointed out. If you could use the SdkTypeProxy and SdkTypeProxy.XmlSerializers that are shipped woth the product you'd only have to do step 10.&lt;/p&gt;
</description></item><item><title>re: Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx#9607840</link><pubDate>Tue, 12 May 2009 21:03:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9607840</guid><dc:creator>Gautam</dc:creator><description>&lt;p&gt;Thanks for the article, very useful, I was also thinking whether we can create a pool of proxy objects so that we can re-use them(like Database Connection pool )... is it considered a best practice ? &amp;nbsp;&lt;/p&gt;</description></item><item><title>re: Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx#9887484</link><pubDate>Fri, 28 Aug 2009 00:49:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9887484</guid><dc:creator>Gregory E</dc:creator><description>&lt;p&gt;I've duplicated your steps and am unable to achieve the startup time you have achieved.&lt;/p&gt;
&lt;p&gt;My first step was to right a small console application with a tweak to the app.config so any temporary generated code is persisted after the application finishes and is placed in a different folder. (see Scott Hanselmans blog about this: &lt;a rel="nofollow" target="_new" href="http://www.hanselman.com/blog/ChangingWhereXmlSerializerOutputsTemporaryAssemblies.aspx"&gt;http://www.hanselman.com/blog/ChangingWhereXmlSerializerOutputsTemporaryAssemblies.aspx&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;//Using the Web Reference method&lt;/p&gt;
&lt;p&gt;DateTime s1 = DateTime.Now;&lt;/p&gt;
&lt;p&gt;new localhost.CrmService();&lt;/p&gt;
&lt;p&gt;DateTime e1 = DateTime.Now;&lt;/p&gt;
&lt;p&gt;double webReferenceTime = (e1 - s1).TotalSeconds;&lt;/p&gt;
&lt;p&gt;//Using the Pre Compiled method&lt;/p&gt;
&lt;p&gt;DateTime s2 = DateTime.Now;&lt;/p&gt;
&lt;p&gt;new Microsoft.Crm.SdkTypeProxy.CrmService();&lt;/p&gt;
&lt;p&gt;DateTime e2 = DateTime.Now;&lt;/p&gt;
&lt;p&gt;double precompiledTime = (e2 - s2).TotalSeconds;&lt;/p&gt;
&lt;p&gt;Test Run 1&lt;/p&gt;
&lt;p&gt;------------&lt;/p&gt;
&lt;p&gt;Web Reference (without generating XmlSerializer assemblies) - 9.15 seconds&lt;/p&gt;
&lt;p&gt;Pre Compiled Assembly - 9.65 seconds&lt;/p&gt;
&lt;p&gt;Looking at the directory that contains the temporary assemblies I can see 2 different temporary assemblies one for the web reference and one for the pre-compiled assembly&lt;/p&gt;
&lt;p&gt;Test Run 2&lt;/p&gt;
&lt;p&gt;------------&lt;/p&gt;
&lt;p&gt;Web Reference (with generating XmlSerializer assemblies) - 4.37 seconds&lt;/p&gt;
&lt;p&gt;Pre Compiled Assembly - 9.52 seconds&lt;/p&gt;
&lt;p&gt;Looking at the directory that contains the temporary assemblies again I only see 1 temporary assembly which judging by the times in Test Run 2 would indicate that the Web Reference is using the pre-generated assembly correctly. &lt;/p&gt;
&lt;p&gt;According your blog post as long as the Microsoft.Crm.SdkTypeProxy.XmlSerializers.dll is in the GAC and you are using the same processor architecture and version than the pre-compiled assembly should see a speed increase because it will use the XmlSerializers.dll. This is clearly not the case if you look at the times it takes to instantiate the first CrmService and the temporary files been generated.&lt;/p&gt;
&lt;p&gt;Why isn't this working for me?&lt;/p&gt;</description></item><item><title>re: Boost performance with Pre-generated XmlSerializers</title><link>http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx#9889379</link><pubDate>Mon, 31 Aug 2009 18:10:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9889379</guid><dc:creator>Gonzalo Ruiz</dc:creator><description>&lt;p&gt;The only reason I know for which this would not work is if the assembly Microsoft.Crm.SdkTypeProxy.XmlSerializers.dll was generated against a different version of the assembly Microsoft.Crm.SdkTypeProxy.dll that you are using. &lt;/p&gt;
&lt;p&gt;Microsoft.Crm.SdkTypeProxy.XmlSerializers.dll remembers the exact assembly Id of its parent assembly, a way to find out whether they match is to disassemble both assemblies. If both of these assemblies are taken from the same source then they should come from the same build so the assembly Id should match.&lt;/p&gt;</description></item></channel></rss>