[Mono-bugs] [Bug 80790][Wis] New - Console output is very slow with 2.0 (character by character)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Feb 10 22:31:58 EST 2007

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 alp at atoker.com.


--- shadow/80790	2007-02-10 22:31:58.000000000 -0500
+++ shadow/80790.tmp.4150	2007-02-10 22:31:58.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 80790
+Product: Mono: Class Libraries
+Version: 1.2
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: alp at atoker.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Console output is very slow with 2.0 (character by character)
+This issue is present in the 2.0 profile. Compile with gmcs:
+using System;
+public class foo
+	public static void Main ()
+	{
+		Console.WriteLine ("Hello world");
+	}
+strace the program and we see:
+write(1, "H", 1H)                        = 1
+write(1, "e", 1e)                        = 1
+write(1, "l", 1l)                        = 1
+write(1, "l", 1l)                        = 1
+write(1, "o", 1o)                        = 1
+write(1, " ", 1 )                        = 1
+write(1, "w", 1w)                        = 1
+write(1, "o", 1o)                        = 1
+write(1, "r", 1r)                        = 1
+write(1, "l", 1l)                        = 1
+write(1, "d", 1d)                        = 1
+write(1, "\n", 1
+With the 1.0 profile (mcs):
+write(1, "Hello world", 11Hello world)             = 11
+write(1, "\n", 1
+This is ideal.
+The issue only seems to happen when stdout is an interactive tty.
+I noticed this in a math benchmark I was writing. The console output of the
+benchmark is so minimal that IO overhead was usually negligible so I have
+never gone through the effort to redirect it to file, but since writing a
+character at a time is a worst-case scenario, it actually slowed down the
+It also explains why you can see each character being printed one at a time
+on slower devices like the Nokia 770/N800.
+In terms of performance, printing character by character may or may not
+slow down the Mono process (haven't checked) but it definitely causes
+slowdowns all the way up the chain to the terminal emulator, framebuffer
+display etc. resulting in slowdowns and flicker.

More information about the mono-bugs mailing list