Some findings...

I have added some counters in the code (ahhh, 24 years back in the past, when I was adding printlf() in my C code ;).

Here is what I found :
- most of the time is consumed in the CachedRecordManager.update() method, which calls BaseRecordManager.update( long recid, Object obj, Serializer serializer ). This method updates the PhysicalRowIdManager with the serialized data. - serialization can take seconds. In this case, I try to redo the very same serialization, and strange enough, I get some very different timing. Here is the modified code :

...
        long t0 = System.nanoTime();
        byte[] data = serializer.serialize( obj );
        long t1 = System.nanoTime();

        if ( ( ( t1 - t0 ) / 1000 ) > 400000 )
        {
System.out.println( (t1-t0) + " : " + obj.getClass().getName() );
            long tt0 = System.nanoTime();
            byte[] data2 = serializer.serialize( obj );
            long tt1 = System.nanoTime();
System.out.println( (tt1-tt0) + " *: " + obj.getClass().getName() );
        }
...

and here are some traces I get :
1037138000 : java.lang.Integer
21000 *: java.lang.Integer

5500475000 : jdbm.btree.BTree
67000 *: jdbm.btree.BTree

402012000 : jdbm.btree.BTree
287636000 *: jdbm.btree.BTree

As we can see, serializing twice the same data does not take the same time (sometime it's way faster). It's very curious that serializing an Integer cost that much time, btw.

I'm investigating atm...

--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com


Reply via email to