[Mono-dev] BufferedStream.ReadByte and WriteByte are extremely inefficient

Alan McGovern alan.mcgovern at gmail.com
Mon Jan 11 18:26:42 EST 2010


Actually, ignore the part about the 1 >= m_buffer.Length. On second reading
that's fine ;)

Alan.

On Mon, Jan 11, 2010 at 11:24 PM, Alan McGovern <alan.mcgovern at gmail.com>wrote:

> Hey,
>
> This patch does three things:
>
> 1) Optimises away some allocations - good
> 2) Added extra checks which throw exceptions - without providing testcases
> - bad
> 3) A fair few whitespace changes - bad
>
> Would you be able to submit two patches instead? The first should do the
> optimisation, the second should add the test+exception for CanRead and
> CanWrite as well as adding some nunit test cases which show that this is
> required.
>
> Also:
>
> +				if (1 >= m_buffer.Length) {
> +					return m_stream.ReadByte ();
>
> That should really be: if m_buffer.Length == 0 as the case where the Length
> is >= 0 is already handled. It makes things easier to understand.
>
> Thanks,
> Alan.
>
> On Mon, Jan 11, 2010 at 10:53 PM, Tom Philpot <tom.philpot at logos.com>wrote:
>
>> Sorry, for double posting this patch. Snow Leopard's Mail.app w/ Exchange
>> support turned my "This is contributed under the MIT/X11 license" into an
>> attachment.
>>
>> For the record, the code in this patch is contributed under the MIT/X11
>> license
>>
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100111/b581a14a/attachment.html 


More information about the Mono-devel-list mailing list