[Mono-list] Profiling web app to find where memory is going

Ben Maurer bmaurer at ximian.com
Fri Jan 13 10:17:04 EST 2006


> I'm not sure if this is related but there are some terrible
> inefficiencies in following two classes
>
> mcs/class/corlib/System.IO/TextWriter.cs
> mcs/class/System.Web/System.Web/HttpWriter.cs
>
> I've not had a chance to make a patch yet, so I'll explain so someone
> else can if they want to get it done before I can. But suffice to say
> that how one calls Write on a TextWriter output stream in XSP/Mod_mono
> can double your connections/sec (as it did for me)!
>
> It comes down to this method in TextWriter.cs
>
> public virtual void Write (char[] value)
> {
> 	if (value != null) {
> 		for (int i = 0; i < value.Length; ++i)
> 			Write (value [i]);
> 	}
> }
>
> Which I think should look like this
>
> public virtual void Write (char[] value)
> {
> 	// No if statement needed since TextWriter is abstract
> 	// the implementing class should take care of checking for null.
> 	Write(value, 0, value.Length);
> }
>

I fixed this part of the issue in System.IO. Thanks for pointing this out!

-- Ben




More information about the Mono-list mailing list