Author: krasnov
Date: 2007-05-14 09:51:06 -0400 (Mon, 14 May 2007)
New Revision: 77347
Modified:
trunk/mcs/class/System.Web/System.Web/ChangeLog
trunk/mcs/class/System.Web/System.Web/HttpWriter.cs
Log:
* HttpWriter.cs: GetMaxByteCount was used in Write and WriteString methods to
improve performance of HttpWriter
Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-05-14 13:41:32 UTC
(rev 77346)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-05-14 13:51:06 UTC
(rev 77347)
@@ -1,3 +1,8 @@
+2007-05-14 Vladimir Krasnov <[EMAIL PROTECTED]>
+
+ * HttpWriter.cs: GetMaxByteCount was used in Write and WriteString
+ methods to improve performance of HttpWriter
+
2007-05-14 Igor Zelmanovich <[EMAIL PROTECTED]>
* HttpApplication.cs:
Modified: trunk/mcs/class/System.Web/System.Web/HttpWriter.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpWriter.cs 2007-05-14 13:41:32 UTC
(rev 77346)
+++ trunk/mcs/class/System.Web/System.Web/HttpWriter.cs 2007-05-14 13:51:06 UTC
(rev 77347)
@@ -120,10 +120,10 @@
if (buffer == null || index < 0 || count < 0 ||
(buffer.Length - index) < count)
throw new ArgumentOutOfRangeException ();
- int length = encoding.GetByteCount (buffer, index,
count);
+ int length = encoding.GetMaxByteCount (count);
byte [] bytebuffer = GetByteBuffer (length);
- encoding.GetBytes (buffer, index, count, bytebuffer, 0);
- output_stream.Write (bytebuffer, 0, length);
+ int realLength = encoding.GetBytes (buffer, index,
count, bytebuffer, 0);
+ output_stream.Write (bytebuffer, 0, realLength);
if (response.buffer)
return;
@@ -145,17 +145,10 @@
if (index < 0 || count < 0 || ((index + count >
s.Length)))
throw new ArgumentOutOfRangeException ();
- int length;
- if (index == 0 && count == s.Length) {
- length = encoding.GetByteCount (s);
- } else {
- char [] chars = s.ToCharArray (index, count);
- length = encoding.GetByteCount (chars);
- }
-
+ int length = encoding.GetMaxByteCount (count);
byte [] bytebuffer = GetByteBuffer (length);
- encoding.GetBytes (s, index, count, bytebuffer, 0);
- output_stream.Write (bytebuffer, 0, length);
+ int realLength = encoding.GetBytes (s, index, count,
bytebuffer, 0);
+ output_stream.Write (bytebuffer, 0, realLength);
if (response.buffer)
return;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches