[Mono-dev] [Patch] to significantly shorten Char.cs

Andreas Nahr ClassDevelopment at A-SoftTech.com
Sun Jun 29 18:37:43 EDT 2008


Hi Rodrigo,

 

very good suggestion ;)

Attached is a patch that only contains the Is* changes.

 

Happy Hacking

Andreas

 

Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von Rodrigo
Kumpera
Gesendet: Samstag, 28. Juni 2008 00:37
An: Andreas Nahr
Cc: mono-devel
Betreff: Re: [Mono-dev] [Patch] to significantly shorten Char.cs

 

Andreas,

How about splitting your patches in two? One with the lesser risky
CheckParameter changes and other with the Is*** changes.
The CheckParameter changes look lovely, go ahead commit then.
I would like to do some testing on other changes, that are more comple and
unfortunately I won't have time until late next week.

I know it's more work on your side, but it makes the review process easier
for both of us. 

Thanks,
Rodrigo



On Thu, Jun 26, 2008 at 6:24 PM, Andreas Nahr
<ClassDevelopment at a-softtech.com> wrote:

Well the main improvement is the shortening of the String-Parameter methods.
It does not affect performance negatively as far as I measured because the
methods now get inlined but were too large before.
I know that the code wasn't duplicated for performance reasons before,
because I actually wrote that code. Well most of Char anyways... ;)

IsWhiteSpace is now somewhat faster. Similar Prog from below (do not have
the original anymore) went from 21 sec total to 16,5 sec (AMD 3,2Ghz XP)
(testing one positive + one negative case). It simply saves some opcodes.

public static void Main()
{
   int tickCount = Environment.TickCount;
   for (int i = 0; i < 0x3b9aca00; i++)
   {
       char.IsWhiteSpace('v');
   }
   Console.WriteLine((int) (Environment.TickCount - tickCount));
   tickCount = Environment.TickCount;
   for (int j = 0; j < 0x3b9aca00; j++)
   {
       char.IsWhiteSpace(' ');
   }
   Console.WriteLine((int) (Environment.TickCount - tickCount));
}

And no, IsWhiteSpace did not get optimized away ;)

> -----Ursprüngliche Nachricht-----
> Von: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] Im Auftrag von Atsushi Eno
> Gesendet: Donnerstag, 26. Juni 2008 23:25
> An: 'mono-devel'
> Betreff: Re: [Mono-dev] [Patch] to significantly shorten Char.cs

>
> I have some comments even without reading your application/octet-stream
> patch (I ususally don't read them).
>
> - Sometimes we have some code pieces that look like duplicates
>    exactly because of performance improvements.
> - For performance improvements there should be some benchmark
>    results with sources.
>
> Atsushi Eno
>
>
> Andreas Nahr wrote:
> > The attached patch reduces code duplication in Char by more than 130
> lines
> > and improves the performance of some methods a little bit.
> >
> > Somebody please have a short look...
> >
> > Happy Hacking
> > Andreas
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

_______________________________________________
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/20080630/624cea93/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Char.patch
Type: application/octet-stream
Size: 4295 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080630/624cea93/attachment-0001.obj 


More information about the Mono-devel-list mailing list