From d0a11ec68124168453998d9cdb888d0f10d3a14d Mon Sep 17 00:00:00 2001 From: Ben Maurer Date: Sun, 5 Sep 2004 16:22:46 +0000 Subject: [PATCH] 2004-09-05 Ben Maurer * MethodCall.cs, CADMessages.cs: String.Copy (x) is the same thing as new string (x.ToCharArray ()), however it involves half the memory allocation svn path=/trunk/mcs/; revision=33369 --- mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs | 6 +++--- mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog | 6 ++++++ mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs index 6df79ddf1b2..1ac41a6b0f3 100755 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs @@ -170,8 +170,8 @@ namespace System.Runtime.Remoting.Messaging { CADObjRef objref = arg as CADObjRef; if (null != objref) { - string typeName = new string (objref.TypeName.ToCharArray()); - string uri = new string (objref.URI.ToCharArray()); + string typeName = string.Copy (objref.TypeName); + string uri = string.Copy (objref.URI); int domid = objref.SourceDomain; ChannelInfo cinfo = new ChannelInfo (new CrossAppDomainData (domid)); @@ -224,7 +224,7 @@ namespace System.Runtime.Remoting.Messaging { case TypeCode.UInt16: return (UInt16)arg; case TypeCode.UInt32: return (UInt32)arg; case TypeCode.UInt64: return (UInt64)arg; - case TypeCode.String: return new String (((string)arg).ToCharArray()); + case TypeCode.String: string.Copy ((string) arg); case TypeCode.DateTime: return new DateTime (((DateTime)arg).Ticks); default: if (arg is TimeSpan) return new TimeSpan (((TimeSpan)arg).Ticks); diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog index 31b0acd440c..3b8f2d45d57 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog @@ -1,3 +1,9 @@ +2004-09-05 Ben Maurer + + * MethodCall.cs, CADMessages.cs: String.Copy (x) is the same + thing as new string (x.ToCharArray ()), however it involves + half the memory allocation + 2004-07-22 Lluis Sanchez Gual * MethodCall.cs: Use RemotingServices.GetMethodBaseFromName to get the diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs index 47dbb9d0beb..692cf7073fa 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs @@ -75,9 +75,9 @@ namespace System.Runtime.Remoting.Messaging { internal MethodCall (CADMethodCallMessage msg) { - _typeName = new string (msg.TypeName.ToCharArray ()); - _uri = new string (msg.Uri.ToCharArray ()); - _methodName = new string (msg.MethodName.ToCharArray ()); + _typeName = string.Copy (msg.TypeName); + _uri = string.Copy (msg.Uri); + _methodName = string.Copy (msg.MethodName); // Get unmarshalled arguments ArrayList args = msg.GetArguments (); -- 2.11.4.GIT