polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: setAccessible( true )
Date Sat, 08 Apr 2017 23:49:21 GMT
Yeah, already pre-1.0 we were fighting to move all setAccessible() to model
creation where they belong and ensure none were executed in runtime. IF
they have snuck back into runtime, then yes they should be pushed back. IF
they are simply called too many times in bootstrap, then I don't worry too
much about it and wouldn't spend time locate them.


On Sun, Apr 9, 2017 at 12:03 AM, Paul Merlin <paulmerlin@apache.org> wrote:

> Gang,
> We use accessibleObject.setAccessible( true ) a bit too agressively.
> This is a performance killer because of the JVM security checks it implies.
> Some profiling showed me that's it's often on the critical path, Well
> that's because I profiled the bootstrap phase for most of the cases.
> BTW, the new serialization subsystem is way faster than the previous one
> \o/
> JSONEntityState still is a hotspot, but that's another topic.
> There are places where setAccessible( true ) is simply not needed and I
> will remove them.
> Unfortunately, o.isAccessible() does not check if it is actually
> accessible but simply if setAccessible( true ) was called on it to
> forcibly make it accessible. We have some of these checks here and
> there, I'll verify if they are legitimate.
> There are places where it supports e.g. using private classes as mixins,
> and injection to private fields. For some types of
> composites/fragments/etc.. calls to setAccessible() are made when
> creating the model, for some others they are made during runtime
> repeatedly. I'll move all these at bootstrap time so we don't pay that
> cost at runtime.
> /Paul

Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message