cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Cayenne object storage / memory usage
Date Fri, 09 Jun 2017 19:41:41 GMT

> On Jun 9, 2017, at 9:29 PM, John Huss <johnthuss@gmail.com> wrote:
> 
>>> I can't imagine a more efficient representation that fields.
>> 
>> True, but fields also require reflection to be accessed "from below" (by
>> Cayenne).
> 
> 
> It doesn't have to use reflection. With Java 7 and newer you can use
> strings in switch statements with a single jump, which is what I'm doing.
> The class template generates the readPropertyDirectly method with the
> switch statement in it.  This is both fast and simple.  Also, using fields
> makes it much easier to inspect your objects in the debugger, which is
> handy.

Yeah, using fields would be great. It is certainly much more developer-friendly. I'd like
to run some benchmarks on "switch", but this may be a quick way for us to improve the framework
without rewriting the stack.

The only potential advantage of an Object[] approach would be the ability to replace object
state atomically. Maybe someday we'll be able to take advantage of that. But at the moment
what you are suggesting looks very promising and also "easy".

Andrus


Mime
View raw message