.Net 1.1:
Serialize-Duration 0: 00:00:01.3920016
Deserialize-Duration 0: 00:00:01.6223328
Serialize-Duration 1: 00:00:01.1917136
Deserialize-Duration 1: 00:00:01.5722608
Serialize-Duration 2: 00:00:01.2217568
Deserialize-Duration 2: 00:00:01.6123184
Serialize-Duration 3: 00:00:01.2918576
Deserialize-Duration 3: 00:00:01.5221888
Serialize-Duration 4: 00:00:01.3519440
Deserialize-Duration 4: 00:00:01.5322032
.Net 2.0:
Serialize-Duration 0: 00:00:01.8126064
Deserialize-Duration 0: 00:00:02.9342192
Serialize-Duration 1: 00:00:01.7224768
Deserialize-Duration 1: 00:00:02.9442336
Serialize-Duration 2: 00:00:01.7425056
Deserialize-Duration 2: 00:00:02.9442336
Serialize-Duration 3: 00:00:01.7324912
Deserialize-Duration 3: 00:00:02.9141904
Serialize-Duration 4: 00:00:01.7324912
Deserialize-Duration 4: 00:00:02.9642624
Here is the source code of the test program:
---------------------
package SlowPerformance;
import java.io.*;
public class Class1
{
public static class Person implements Serializable
{
private static final long serialVersionUID = -6216517144513189897L;
public String _firstname;
public String _lastname;
public int _age;
public Address[] _addresses;
public Person() { }
public Person(String firstname, String lastname, int age)
{
_firstname = firstname;
_lastname = lastname;
_age = age;
_addresses = new Address[]
{
new Address("Somestreet", 18, "London"),
new Address("Anystreet", 82, "New York"),
new Address("Anyway", 819, "Berlin")
};
}
}
public static class Address implements Serializable
{
private static final long serialVersionUID = 1784371920273890692L;
private String _street;
private int _number;
private String _city;
private double _income;
public Address() { }
public Address(String street, int number, String city)
{
_street = street;
_number = number;
_city = city;
_income = Math.random();
}
}
public static void main(String[] args) throws Exception
{
Person[] persons = new Person[10000];
for (int i = 0; i < persons.length; i++)
persons
for (int i = 0; i < 5; i++)
{
// Write objects
byte[] data;
{
System.DateTime start = System.DateTime.get_Now();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(persons);
oos.close();
data = baos.toByteArray();
System.Console.WriteLine("Serialize-Duration " + i + ": " + System.DateTime.get_Now().Subtract(start));
}
// Read objects
{
System.DateTime start = System.DateTime.get_Now();
ByteArrayInputStream bais = new ByteArrayInputStream(data);
ObjectInputStream ois = new ObjectInputStream(bais);
Person[] persons2 = (Person[])ois.readObject();
ois.close();
System.Console.WriteLine("Deserialize-Duration " + i + ": " + System.DateTime.get_Now().Subtract(start));
}
}
}
}
-----------------------
Thank you very much for any hints.
Best regards,
Michael

Serialization much slower in .NET 2.0
SngThk
Regards,
Michael
CoolVanilla
Thanks for reporting this issue. We are looking into this.
We will keep you updated.
Thanks,
Varun
surftex
Do you know anything new about this, you told me you would keep me up to date ...
Regards,
Mike