Explorar el Código

2007-12-13 Marek Habersack <[email protected]>

	* TemplateControlCompiler.cs, AspComponentFoundry.cs,
	AssemblyBuilder.cs, AppResourcesCompiler.cs,
	AppResourcesAssemblyBuilder.cs, AppCodeCompiler.cs: speed
	optimization - use String.Concat instead of String.Format in some
	cases.
2007-12-13  Marek Habersack  <[email protected]>

	* MailAddress.cs, SmtpClient.cs, MailMessageWrapper.cs: speed
	optimization - use String.Concat instead of String.Format in some
	cases.
2007-12-13  Marek Habersack  <[email protected]>

	* HttpRequest.cs, HttpResponse.cs, SiteMapNode.cs, HttpRuntime.cs,
	HttpResponseStream.cs, HttpApplication.cs, HttpCachePolicy.cs:
	speed optimization - use String.Concat instead of String.Format in
	some cases.
2007-12-13  Marek Habersack  <[email protected]>

	* FileMatchingInfo.cs. MachineKeyRegistryStorage.cs: speed
	optimization - use String.Concat instead of String.Format in some
	cases.

svn path=/trunk/mcs/; revision=91234
Marek Habersack hace 18 años
padre
commit
4ce3af2b1f
Se han modificado 22 ficheros con 71 adiciones y 60 borrados
  1. 3 3
      mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
  2. 1 1
      mcs/class/System.Web/System.Web.Compilation/AppResourcesAssemblyBuilder.cs
  3. 1 1
      mcs/class/System.Web/System.Web.Compilation/AppResourcesCompiler.cs
  4. 1 1
      mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs
  5. 1 1
      mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
  6. 8 0
      mcs/class/System.Web/System.Web.Compilation/ChangeLog
  7. 1 1
      mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
  8. 6 0
      mcs/class/System.Web/System.Web.Configuration/ChangeLog
  9. 1 1
      mcs/class/System.Web/System.Web.Configuration/FileMatchingInfo.cs
  10. 4 8
      mcs/class/System.Web/System.Web.Configuration/MachineKeyRegistryStorage.cs
  11. 6 0
      mcs/class/System.Web/System.Web.Mail/ChangeLog
  12. 5 9
      mcs/class/System.Web/System.Web.Mail/MailAddress.cs
  13. 11 17
      mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs
  14. 3 3
      mcs/class/System.Web/System.Web.Mail/SmtpClient.cs
  15. 7 0
      mcs/class/System.Web/System.Web/ChangeLog
  16. 1 1
      mcs/class/System.Web/System.Web/HttpApplication.cs
  17. 3 3
      mcs/class/System.Web/System.Web/HttpCachePolicy.cs
  18. 2 2
      mcs/class/System.Web/System.Web/HttpRequest.cs
  19. 1 3
      mcs/class/System.Web/System.Web/HttpResponse.cs
  20. 2 2
      mcs/class/System.Web/System.Web/HttpResponseStream.cs
  21. 1 1
      mcs/class/System.Web/System.Web/HttpRuntime.cs
  22. 2 2
      mcs/class/System.Web/System.Web/SiteMapNode.cs

+ 3 - 3
mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs

@@ -364,7 +364,7 @@ namespace System.Web.Compilation
 			if (cs != null) {
 				string aname;
 				for (int i = 0; i < cs.CodeSubDirectories.Count; i++) {
-					aname = String.Format ("App_SubCode_{0}", cs.CodeSubDirectories[i].DirectoryName);
+					aname = String.Concat ("App_SubCode_", cs.CodeSubDirectories[i].DirectoryName);
 					assemblies.Add (new AppCodeAssembly (
 								aname,
 								Path.Combine (appCode, cs.CodeSubDirectories[i].DirectoryName)));
@@ -416,7 +416,7 @@ namespace System.Web.Compilation
 		void GetProfileSettingsSerializeAsAttribute (ProfileSection ps, CodeAttributeDeclarationCollection collection,
 							     SerializationMode mode)
 		{
-			string parameter = String.Format ("SettingsSerializeAs.{0}", mode.ToString ());
+			string parameter = String.Concat ("SettingsSerializeAs.", mode.ToString ());
 			collection.Add (
 				new CodeAttributeDeclaration (
 					"SettingsSerializeAs",
@@ -549,7 +549,7 @@ namespace System.Web.Compilation
 
 		string MakeGroupName (string name)
 		{
-			return String.Format ("ProfileGroup{0}", name);
+			return String.Concat ("ProfileGroup", name);
 		}
 		
 		// FIXME: there should be some validation of syntactic correctness of the member/class name

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/AppResourcesAssemblyBuilder.cs

@@ -141,7 +141,7 @@ namespace System.Web.Compilation
 				Directory.CreateDirectory (baseDir);
 			
 			string baseFileName = Path.GetFileNameWithoutExtension (baseAssemblyPath);
-			string fileName = String.Format ("{0}.resources.dll", baseFileName);
+			string fileName = String.Concat (baseFileName, ".resources.dll");
 			fileName = Path.Combine (baseDir, fileName);
 
 			CodeCompileUnit assemblyInfo = GenerateAssemblyInfo (cultureName);

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/AppResourcesCompiler.cs

@@ -359,7 +359,7 @@ namespace System.Web.Compilation
 				nsname = "Resources";
 			} else {
 				if (!nsname.StartsWith ("Resources", StringComparison.InvariantCulture))
-					nsname = String.Format ("Resources.{0}", nsname);
+					nsname = String.Concat ("Resources.", nsname);
 				classname = classname.Substring(1);
 			}
 

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs

@@ -313,7 +313,7 @@ namespace System.Web.Compilation
 				if (assembly == null && assemblyName != null)
 					assembly = GetAssemblyByName (assemblyName, true);
 #endif
-				string typeName = String.Format ("{0}.{1}", nameSpace, componentName);
+				string typeName = String.Concat (nameSpace, ".", componentName);
 				if (assembly != null)
 					return assembly.GetType (typeName, true, true);
 

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs

@@ -178,7 +178,7 @@ namespace System.Web.Compilation {
 			if (extension == null)
 				throw new ArgumentNullException ("extension");
 			
-			return temp_files.AddExtension (String.Format ("_{0}.{1}", temp_files.Count, extension), true);
+			return temp_files.AddExtension (String.Concat ("_", temp_files.Count, ".", extension), true);
 		}
 
 		public CodeDomProvider CodeDomProvider {

+ 8 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,11 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* TemplateControlCompiler.cs, AspComponentFoundry.cs,
+	AssemblyBuilder.cs, AppResourcesCompiler.cs,
+	AppResourcesAssemblyBuilder.cs, AppCodeCompiler.cs: speed
+	optimization - use String.Concat instead of String.Format in some
+	cases.
+
 2007-11-22  Marek Habersack  <[email protected]>
 
 	* PageCompiler.cs: use

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs

@@ -748,7 +748,7 @@ namespace System.Web.Compilation
 				return;			
 
 			string memberName = mi.Name;
-			string resname = String.Format ("{0}.{1}", attvalue, memberName);
+			string resname = String.Concat (attvalue, ".", memberName);
 
 			// __ctrl.Text = System.Convert.ToString(HttpContext.GetLocalResourceObject("ButtonResource1.Text"));
 			string inputFile = parser.InputFile;

+ 6 - 0
mcs/class/System.Web/System.Web.Configuration/ChangeLog

@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* FileMatchingInfo.cs. MachineKeyRegistryStorage.cs: speed
+	optimization - use String.Concat instead of String.Format in some
+	cases.
+
 2007-11-17  Marek Habersack  <[email protected]>
 
 	* HandlerFactoryConfiguration.cs: FileMatchingInfo array must be

+ 1 - 1
mcs/class/System.Web/System.Web.Configuration/FileMatchingInfo.cs

@@ -61,7 +61,7 @@ namespace System.Web.Configuration
 						if (vpath == "/")
 							vpath = String.Empty;
 						
-						MatchExact = String.Format ("{0}/{1}", vpath, s);
+						MatchExact = String.Concat (vpath, "/", s);
 					}
 			}
 				

+ 4 - 8
mcs/class/System.Web/System.Web.Configuration/MachineKeyRegistryStorage.cs

@@ -58,14 +58,10 @@ namespace System.Web.Configuration
 			}
 			
 			string hash = appName.GetHashCode ().ToString ("x");
-			keyEncryption = String.Format ("software\\mono\\asp.net\\{0}\\autogenkeys\\{1}-{2}",
-						       Environment.Version,
-						       hash,
-						       (int)KeyType.Encryption);
-			keyValidation = String.Format ("software\\mono\\asp.net\\{0}\\autogenkeys\\{1}-{2}",
-						       Environment.Version,
-						       hash,
-						       (int)KeyType.Validation);
+			keyEncryption = "software\\mono\\asp.net\\" + Environment.Version.ToString () +
+				"\\autogenkeys\\" + hash + "-" + ((int)KeyType.Encryption).ToString ();
+			keyValidation = "software\\mono\\asp.net\\" + Environment.Version.ToString () +
+				"\\autogenkeys\\" + hash + "-" + ((int)KeyType.Validation).ToString ();
 		}
 		
 		public static byte[] Retrieve (KeyType kt)

+ 6 - 0
mcs/class/System.Web/System.Web.Mail/ChangeLog

@@ -1,3 +1,9 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* MailAddress.cs, SmtpClient.cs, MailMessageWrapper.cs: speed
+	optimization - use String.Concat instead of String.Format in some
+	cases.
+
 2007-11-09  Marek Habersack  <[email protected]>
 
 	* SmtpClient.cs: Connect only after reading in the fields that may

+ 5 - 9
mcs/class/System.Web/System.Web.Mail/MailAddress.cs

@@ -54,7 +54,7 @@ namespace System.Web.Mail {
 	}
 
 	public string Address {
-	    get { return String.Format( "{0}@{1}" , user , host ); }
+		get { return String.Concat (user, "@", host); }
 	    set {
 		
 		string[] parts = value.Split( new char[] { '@' } );
@@ -112,20 +112,16 @@ namespace System.Web.Mail {
 	
 	    if( name == null ) {
 		
-		retString = String.Format( "<{0}>" , this.Address );
+		    retString = String.Concat ("<", this.Address, ">");
 	    
 	    } else {
 		
 		string personName = this.Name;
 
-		if( MailUtil.NeedEncoding( personName ) ) {
-		    personName = String.Format( "=?{0}?B?{1}?=",
-					        Encoding.Default.BodyName , 
-						MailUtil.Base64Encode( personName ) ) ;
-		}
+		if( MailUtil.NeedEncoding( personName ))
+		    personName = "=?" + Encoding.Default.BodyName + "?B?" + MailUtil.Base64Encode(personName) + "?=";
 
-		retString = String.Format( "\"{0}\" <{1}>" , personName , this.Address);
-	    
+		retString = "\"" + personName + "\" <" + this.Address + ">";
 	    }
 	    
 	    return retString;

+ 11 - 17
mcs/class/System.Web/System.Web.Mail/MailMessageWrapper.cs

@@ -79,9 +79,7 @@ namespace System.Web.Mail {
 		    		
 		    byte[] subjectBytes = message.BodyEncoding.GetBytes( message.Subject );
 		    // encode the subject with Base64
-		    header.Subject = String.Format( "=?{0}?B?{1}?=" , 
-						    message.BodyEncoding.BodyName ,
-						    Convert.ToBase64String( subjectBytes ) );
+		    header.Subject = "=?" + message.BodyEncoding.BodyName + "?B?" + Convert.ToBase64String (subjectBytes) + "?=";
 		} else {
 		    
 		    header.Subject = message.Subject;
@@ -109,22 +107,18 @@ namespace System.Web.Mail {
 
 	    	    
 	    // set the content type
-	    switch( message.BodyFormat ) {
-		
-	    case MailFormat.Html: 
-		header.ContentType = 
-		    String.Format( "text/html; charset=\"{0}\"" , message.BodyEncoding.BodyName ); 
-		break;
+	    switch( message.BodyFormat ) {		
+		    case MailFormat.Html: 
+			    header.ContentType = String.Concat ( "text/html; charset=\"", message.BodyEncoding.BodyName, "\""); 
+			    break;
 	    
-	    case MailFormat.Text: 
-		header.ContentType = 
-		    String.Format( "text/plain; charset=\"{0}\"" , message.BodyEncoding.BodyName );
-		break;
+		    case MailFormat.Text: 
+			    header.ContentType = String.Concat ( "text/plain; charset=\"", message.BodyEncoding.BodyName, "\"");
+			    break;
 	    
-	    default: 
-		header.ContentType = 
-		    String.Format( "text/html; charset=\"{0}\"" , message.BodyEncoding.BodyName );
-		break;
+		    default: 
+			    header.ContentType = String.Concat ( "text/html; charset=\"", message.BodyEncoding.BodyName, "\"");
+			    break;
 	    }
 	    
 	    	    

+ 3 - 3
mcs/class/System.Web/System.Web.Mail/SmtpClient.cs

@@ -211,7 +211,7 @@ namespace System.Web.Mail {
 			// set the Content-Type header to multipart/mixed
 			string bodyContentType = msg.Header.ContentType;
 
-			msg.Header.ContentType = String.Format ("multipart/mixed;\r\n   boundary={0}", boundary);
+			msg.Header.ContentType = String.Concat ("multipart/mixed;\r\n   boundary=", boundary);
 		
 			// write the header
 			smtp.WriteHeader (msg.Header);
@@ -258,9 +258,9 @@ namespace System.Web.Mail {
 				MailHeader aHeader = new MailHeader ();
 		
 				aHeader.ContentType = 
-					String.Format (MimeTypes.GetMimeType (fileInfo.Name) + "; name=\"{0}\"",fileInfo.Name);
+					String.Concat (MimeTypes.GetMimeType (fileInfo.Name), "; name=\"", fileInfo.Name, "\"");
 		
-				aHeader.ContentDisposition = String.Format ("attachment; filename=\"{0}\"", fileInfo.Name);
+				aHeader.ContentDisposition = String.Concat ("attachment; filename=\"", fileInfo.Name, "\"");
 				aHeader.ContentTransferEncoding = a.Encoding.ToString();
 				smtp.WriteHeader (aHeader);
 		   

+ 7 - 0
mcs/class/System.Web/System.Web/ChangeLog

@@ -1,3 +1,10 @@
+2007-12-13  Marek Habersack  <[email protected]>
+
+	* HttpRequest.cs, HttpResponse.cs, SiteMapNode.cs, HttpRuntime.cs,
+	HttpResponseStream.cs, HttpApplication.cs, HttpCachePolicy.cs:
+	speed optimization - use String.Concat instead of String.Format in
+	some cases.
+
 2007-12-13 Igor Zelmanovich <[email protected]>
 	
 	* HttpApplication.cs:

+ 1 - 1
mcs/class/System.Web/System.Web/HttpApplication.cs

@@ -1221,7 +1221,7 @@ namespace System.Web {
 		internal object LocateHandler (string verb, string url)
 		{
 			Hashtable cache = GetHandlerCache ();
-			string id = String.Format ("{0}{1}", verb, url);
+			string id = String.Concat (verb, url);
 			object ret = cache [id];
 
 			if (ret != null)

+ 3 - 3
mcs/class/System.Web/System.Web/HttpCachePolicy.cs

@@ -372,16 +372,16 @@ namespace System.Web {
 				}
 			} else {
 				if (MaxAge.TotalSeconds != 0)
-					cc = String.Format ("{0}, max-age={1}", cc, (long) MaxAge.TotalSeconds);
+					cc = String.Concat (cc, ", max-age=", ((long) MaxAge.TotalSeconds).ToString ());
 
 				string expires = TimeUtil.ToUtcTimeString (expire_date);
 				headers.Add (new UnknownResponseHeader ("Expires", expires));
 			}
 
 			if (set_no_store)
-				cc = String.Format ("{0}, no-store", cc);
+				cc = String.Concat (cc, ", no-store");
 			if (set_no_transform)
-				cc = String.Format ("{0}, no-transform", cc);
+				cc = String.Concat (cc, ", no-transform");
 			
 			headers.Add (new UnknownResponseHeader ("Cache-Control", cc));
 

+ 2 - 2
mcs/class/System.Web/System.Web/HttpRequest.cs

@@ -1469,8 +1469,8 @@ namespace System.Web {
 			
 			public override string ToString ()
 			{
-				return string.Format ("ContentType {0}, Name {1}, Filename {2}, Start {3}, Length {4}",
-					ContentType, Name, Filename, Start, Length);
+				return "ContentType " + ContentType + ", Name " + Name + ", Filename " + Filename + ", Start " +
+					Start.ToString () + ", Length " + Length.ToString ();
 			}
 		}
 		

+ 1 - 3
mcs/class/System.Web/System.Web/HttpResponse.cs

@@ -337,9 +337,7 @@ namespace System.Web {
 		}
 		
 		public string Status {
-			get {
-				return String.Format ("{0} {1}", status_code, StatusDescription);
-			}
+			get { return String.Concat (status_code.ToString (), " ", StatusDescription); }
 
 			set {
 				int p = value.IndexOf (' ');

+ 2 - 2
mcs/class/System.Web/System.Web/HttpResponseStream.cs

@@ -324,7 +324,7 @@ namespace System.Web {
 
 			public override string ToString ()
 			{
-				return String.Format ("file {0} {1} bytes from position {2}", file, length, offset);
+				return "file " + file + " " + length.ToString () + " bytes from position " + offset.ToString ();
 			}	
 		}
 	
@@ -354,7 +354,7 @@ namespace System.Web {
 
 			int i = 0;
 			if (l >= 0) {
-				string s = String.Format ("{0:x}", l);
+				string s = l.ToString ("x");
 				for (; i < s.Length; i++)
 					chunk_buffer [i] = (byte) s [i];
 			}

+ 1 - 1
mcs/class/System.Web/System.Web/HttpRuntime.cs

@@ -596,7 +596,7 @@ namespace System.Web {
 							genericNameBase + ".compiled");
 			PreservationFile pf = new PreservationFile ();
 			try {
-				pf.VirtualPath = String.Format ("/{0}/", genericNameBase);
+				pf.VirtualPath = String.Concat ("/", genericNameBase, "/");
 
 				AssemblyName an = asm.GetName ();
 				pf.Assembly = an.Name;

+ 2 - 2
mcs/class/System.Web/System.Web/SiteMapNode.cs

@@ -231,9 +231,9 @@ namespace System.Web {
 				string reskey = provider.ResourceKey;
 
 				if (!String.IsNullOrEmpty (reskey))
-					reskey = String.Format ("{0}.{1}.{2}", reskey, implicitResourceKey, attributeName);
+					reskey = reskey + "." + implicitResourceKey + "." + attributeName;
 				else
-					reskey = String.Format ("{0}.{1}", implicitResourceKey, attributeName);
+					reskey = String.Concat (implicitResourceKey, ".", attributeName);
 				object o = HttpContext.GetGlobalResourceObject ("Web.sitemap", reskey);
 				if (o is string)
 					return (string) o;