[Mono-bugs] [Bug 55906][Wis] New - concat'ing a large number of strings does not use the params overload

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 22 Mar 2004 12:44:33 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=55906

--- shadow/55906	2004-03-22 12:44:33.000000000 -0500
+++ shadow/55906.tmp.3577	2004-03-22 12:44:33.000000000 -0500
@@ -0,0 +1,86 @@
+Bug#: 55906
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: concat'ing a large number of strings does not use the params overload
+
+Take the following code:
+
+using System;
+
+class T {
+	static void Main ()
+	{
+		string name = "foo";
+		string s =
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n" +
+		      name + "bar\n";
+	}
+}
+
+
+We generate:
+
+      IL_0000:  ldstr "foo"
+        IL_0005:  stloc.0
+        IL_0006:  ldloc.0
+        IL_0007:  ldstr "bar\n"
+        IL_000c:  ldloc.0
+        IL_000d:  ldstr "bar\n"
+        IL_0012:  call string valuetype
+[mscorlib]'System.String'::'Concat'(string, string, string, string)
+        IL_0017:  ldloc.0
+        IL_0018:  ldstr "bar\n"
+        IL_001d:  ldloc.0
+        IL_001e:  call string valuetype
+[mscorlib]'System.String'::'Concat'(string, string, string, string)
+        IL_0023:  ldstr "bar\n"
+        IL_0028:  ldloc.0
+        IL_0029:  ldstr "bar\n"
+        IL_002e:  call string valuetype
+[mscorlib]'System.String'::'Concat'(string, string, string, string)
+        IL_0033:  ldloc.0
+        IL_0034:  ldstr "bar\n"
+        IL_0039:  ldloc.0
+        IL_003a:  call string valuetype
+[mscorlib]'System.String'::'Concat'(string, string, string, string)
+
+
+While csc generates a call to string.concat (string []).