<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>String.Empty versus "" - The real deal</title><link>http://msmvps.com/blogs/senthil/archive/2008/06/27/string-empty-versus-quot-quot.aspx</link><description>This is one topic that keeps popping up every now and then. A lot of people seem to be curious about the performance implications of using one versus the other, and not unexpectedly, a lot of different answers come up. To settle it once for all, here&amp;#39;s</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: String.Empty versus "" - The real deal</title><link>http://msmvps.com/blogs/senthil/archive/2008/06/27/string-empty-versus-quot-quot.aspx#1638957</link><pubDate>Tue, 01 Jul 2008 05:16:53 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1638957</guid><dc:creator>Jamal Mavadat</dc:creator><description>&lt;p&gt;OOPS!!! Sorry matey :)&lt;/p&gt;
&lt;p&gt;Anyway, the constant literal case (&amp;quot;&amp;quot;) goes through internal AppDomain (well Module actually) hash-table (string interning) which is slower during JIT compilation. This is supposed to happen once for every &amp;quot;&amp;quot; usage unless exclusively optimised which makes it implementation-specific though.&lt;/p&gt;
&lt;p&gt;At the other hand, the static field alternative (String.Empty) goes through the same process only once for the whole AppDomain speeding up JIT compilation!&lt;/p&gt;
&lt;p&gt;Both gains and pains are not enough making you ponder; there are lots of performance gains available out there by clever architectural decisions and ...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1638957" width="1" height="1"&gt;</description></item><item><title>re: String.Empty versus "" - The real deal</title><link>http://msmvps.com/blogs/senthil/archive/2008/06/27/string-empty-versus-quot-quot.aspx#1638878</link><pubDate>Mon, 30 Jun 2008 15:31:50 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1638878</guid><dc:creator>Senthil</dc:creator><description>&lt;p&gt;Well no, it&amp;#39;s not the call instruction, but the mov instruction just before it that is the assignment. It moves the reference to the string to ecx and calls DoNothing.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1638878" width="1" height="1"&gt;</description></item><item><title>re: String.Empty versus "" - The real deal</title><link>http://msmvps.com/blogs/senthil/archive/2008/06/27/string-empty-versus-quot-quot.aspx#1638852</link><pubDate>Mon, 30 Jun 2008 09:43:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1638852</guid><dc:creator>Jamal Mavadat</dc:creator><description>&lt;p&gt;No surprise as the &amp;quot;call&amp;quot; instruction is not the real assigment you were looking for to compare performance. You should be continuing drilling down intro the JIT-generated code to find out what happens!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1638852" width="1" height="1"&gt;</description></item></channel></rss>