I want to test the speed of different Serialization Methods. Therefore I need a class. For my purpose this class has to include only members of primitive data types and each object of the class hast to be around 80Byte size.
I tried following:
//Header = 16 Bytes
//long = 8 Byte
// => 80 Byte
public class TestClass implements Serializable {
private long a = new Random().nextLong();
private long b = new Random().nextLong();
private long c = new Random().nextLong();
private long d = new Random().nextLong();
private long e = new Random().nextLong();
private long f = new Random().nextLong();
private long g = new Random().nextLong();
private long h = new Random().nextLong();
}
And so Im creating the Objects:
for (int i = 0; i < 200000; i++) {
TestClass object = new TestClass();
//do something;
}
The problem here is following. This creates only around 846 Objects per ms. But I need up to 60,000 Objects per ms. Is there any solution for this?
Thanks
Aucun commentaire:
Enregistrer un commentaire