[Mono-bugs] [Bug 73570][Wis] Changed - Serialization/Deserialization of double[] array can be enhanced

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Mar 2005 16:05:41 -0500 (EST)

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 lluis@ximian.com.


--- shadow/73570	2005-03-12 23:32:04.000000000 -0500
+++ shadow/73570.tmp.32580	2005-03-23 16:05:41.000000000 -0500
@@ -1,13 +1,13 @@
 Bug#: 73570
 Product: Mono: Class Libraries
 Version: unspecified
 OS: GNU/Linux [Other]
 OS Details: Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 GNU/Linux
-Status: NEW   
+Status: RESOLVED   
+Resolution: FIXED
 Severity: Unknown
 Priority: Wishlist
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: vguzev@yandex.ru               
 QAContact: mono-bugs@ximian.com
@@ -139,6 +139,21 @@
 So, what? This new test case shows that serializing a byte array is
 faster than serializing a dobule array of the same size. I've already
 said that I will review this. But don't expect it to be as fast as
 block copy to a byte array, or even a serialization of an equivalent
 byte array, like in this second test case (I'm now wondering if byte
 swapping would be needed for little-endian systems).
+------- Additional Comments From lluis@ximian.com  2005-03-23 16:05 -------
+This has been fixed in SVN HEAD. The serializer now read/writes data
+in chunks of bytes, and it's much faster in this way.
+Just a last note about your test case: if you don't provide an initial
+capacity when creating MemoryStream, it is initialized with a buffer
+of 256 bytes. The buffer will grow when needed, and growing means
+creating a new array doubling the size of the old one, and copying
+into it the old values. This is an expensive operation and both in
+time and memory.
+If you fix the test case so the MemoryStream is created with the
+correct capacity, and after updating from SVN, you'll get a
+performance that can be compared to the second test case.