I wrote a write class that maps keys to values and works by delegating a fully synchronized EnumMap. The idea is that a record can receive new fields at runtime, while a Bean cannot. I came to the conclusion that with such flexibility comes a performance hit. This compares the Record class with a fully synchronized Bean. For 10 million operations:
Record set(Thing, a) 458 ms Bean setThing(a) 278 ms Record get(Thing) 398 ms Bean getThing 248 ms
So, you need to find out something in your data objects and write a class that models them statically. If you want new fields to be supplemented with your data at runtime, this will cost you.
kiwicptn
source share