[Mono-dev] DateTime/DateTimeFormatInfo patch to reduce Clone()

Atsushi Eno atsushi at ximian.com
Thu Nov 30 04:31:26 EST 2006


Hello,

I noticed that many string[] properties in DateTimeFormatInfo are
used directly in DateTime. They have to return Clone() which are
not neccessary there.

--------
using System;
using System.Globalization;

class Test
{
        public static void Main ()
        {
                for (int i = 0; i < 1000; i++)
                        DateTime.Parse ("2006-11-30T01:01:01.000");
        }
}
--------

Before the patch:
Total memory allocated: 378 KB

After the patch:
Total memory allocated: 292 KB

If it does not look harmful, I'll commit later.

Atsushi Eno

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: datetime-reduce-clone.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061130/58b9eca4/attachment.pl 


More information about the Mono-devel-list mailing list