[Mono-bugs] [Bug 76399][Maj] New - System.IO.StreamReader.ReadLine is incredibly inefficient

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Oct 10 16:14:37 EDT 2005

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 trow at ximian.com.


--- shadow/76399	2005-10-10 16:14:37.000000000 -0400
+++ shadow/76399.tmp.14553	2005-10-10 16:14:37.000000000 -0400
@@ -0,0 +1,28 @@
+Bug#: 76399
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Major
+Component: System
+AssignedTo: gonzalo at ximian.com                            
+ReportedBy: trow at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: System.IO.StreamReader.ReadLine is incredibly inefficient
+Because it creates a new StringBuilder for each line and assembles the
+string one character at a time, just running this:
+  StreamReader reader;
+  reader = new StreamReader ("a 1.7Mb text file");
+  string line;
+  while ((line = reader.ReadLine ()) != null) { }
+Causes 10.7Mb of strings to be allocated.

More information about the mono-bugs mailing list