Forum Stats

  • 3,769,500 Users
  • 2,252,970 Discussions
  • 7,875,060 Comments

Discussions

TupleBinding for complex objects containing other complex objects

aj2568
aj2568 Member Posts: 1
edited Sep 10, 2016 10:03AM in Berkeley DB Java Edition

I am using JE 5.0 and have been using the pass-through ByteArrayBinding as an EntryBinding so far. I came across documentation suggesting that a custom TupleBinding has better performance (https://docs.oracle.com/cd/E17277_02/html/GettingStartedGuide/bindAPI.html#customTuple as well as the GettingStarted guide). So I plan to see if its feasible and preferred option for my use-case.

Example shown in the above article explains how to read primitive types from TupleInput and write primitive type to TupleOutput while defining a custom TupleBinding. However, it doesn't explain how to handle writing and reading complex types to/from TupleOutput and TupleInput respectively.

Any suggestion would be appreciated in finding the best practice to handle complex types inside a custom TupleBinding. Should I be using resorting to read/writeByte[] for complex types? If yes, then would I still get some performance improvements? Or should I instead start using SerialBinding to get some performance improvement over ByteArrayBinding?

Thanks,

Amol

Answers

  • Greybird-Oracle
    Greybird-Oracle Member Posts: 2,690
    edited Sep 10, 2016 10:03AM

    Hi Amol,

    I think you have a misunderstanding. TupleInput/Ouput are not faster than ByteArrayBinding, since ByteArrayBinding does almost no work at all. JE has several serialization formats that are provided for convenience, but if you already have an efficient serialization format of your own, then performance is not a reason to switch to TupleInput/Ouput.

    --mark

This discussion has been closed.