[Mono-bugs] [Bug 52754][Wis] New - BinaryWriter allocates too many char [] buffers for encoding

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 11 Jan 2004 16:06:54 -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=52754

--- shadow/52754	2004-01-11 16:06:54.000000000 -0500
+++ shadow/52754.tmp.18380	2004-01-11 16:06:54.000000000 -0500
@@ -0,0 +1,30 @@
+Bug#: 52754
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: BinaryWriter allocates too many char [] buffers for encoding
+
+If you call
+
+bw.ReadString () many times, you will see a profile like:
+
+     657 KB System.Text.Encoding::GetChars(byte[],int,int)
+         657 KB    12890 System.Char[]                                   
+  Callers (with count) that contribute at least for 1%:
+       12884  100 % System.IO.BinaryReader::ReadString()
+
+What we should do is to allocate one buffer of a specific number of chars,
+and then always use this buffer. That way, we save the cost of allocating
+each time. You can see this by doing ReadString in a tight loop.