Java Object Serialization Performance tips

后端 未结 9 1343
别那么骄傲
别那么骄傲 2021-02-01 11:15

I must serialize a huge tree of objects (7,000) into disk. Originally we kept this tree in a database with Kodo, but it would make thousands upon thousands of Queries to load t

9条回答
  •  误落风尘
    2021-02-01 11:51

    For performance, I'd suggest not using java.io serialisation at all. Instead get down on to the bytes yourself.

    If you are going to java.io serialise the tree you might need to make sure your recursion doesn't get too deep, either by flattening (as say TreeSet does) or arranging to serialise the deepest nodes first (so you have back references rather than nested readObject calls).

    I would be surprised if there wasn't a way in Kodo to read the entire tree in in one (or a few) goes.

提交回复
热议问题