-
1. Re: Poor performance with test...
clebert.suconic Sep 25, 2006 3:50 PM (in response to davidecr)You always need a BufferedOutputStream and BufferedINputStream on JBossObjectOutputStream...
even the regular ObjectOutputStream will work better with a BufferedStream
There is another thread on this forum talking about this.
You should do:
long init = System.currentTimeMillis();
ObjectOutputStream dos = new JBossObjectOutputStream (new BufferedOutputStream(new FileOutputStream("c:\\test.txt")));
dos.writeObject(opportunities);
dos.close();
File f = new File("c:\\test.txt");
System.out.println("result bytes = " + f.length());
System.out.println("result time = " + (System.currentTimeMillis() - init)); -
2. Re: Poor performance with test...
lxk123 Nov 9, 2006 7:45 PM (in response to davidecr)I have similar experience: this package is slower than standard JDK 1.4.2 and consuming more memory. Is there something wrong on the following code snippet?
---------------------
ByteArrayOutputStream bstream = new ByteArrayOutputStream();
org.jboss.serial.io.JBossObjectOutputStream out = new org.jboss.serial.io.JBossObjectOutputStream(bstream);
out.writeObject(obj);
out.close();
// Loading the memory block as an Object
ByteArrayInputStream binstream = new ByteArrayInputStream(bstream.toByteArray());
org.jboss.serial.io.JBossObjectInputStream oin = new org.jboss.serial.io.JBossObjectInputStream(binstream);
Object newobj = oin.readObject(); -
3. Re: Poor performance with test...
clebert.suconic Nov 10, 2006 1:30 AM (in response to davidecr)You are probably measuring classLoading time...
You need to ignore first measuring... considering only steady time. -
4. Re: Poor performance with test...
lxk123 Nov 10, 2006 3:02 PM (in response to davidecr)The measure is taking against 1000 runs of cloning a same object, and the class loading should not be a big impact here.
By the way, the smartClone method provided works great. On my test, it is more than twice as fast as the standard serialization.
-------------
ByteArrayOutputStream bstream = new ByteArrayOutputStream();
org.jboss.serial.io.JBossObjectOutputStream out = new org.jboss.serial.io.JBossObjectOutputStream(bstream);
Object newobj = out.smartClone(obj); -
5. Re: Poor performance with test...
clebert.suconic Nov 10, 2006 4:43 PM (in response to davidecr)On the Benchmarks I have done I always ignored 100 first elements to be fair.. not computing ClassLoading as JDK classes get sometimes pre-loaded (Specially Serialization)
Also.. I always used the same ByteArrrayOutputStream (by calling reset)...
And of course my Java and JBoss examples were the same. I needed to be fair on both sides.