polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <paulmer...@apache.org>
Subject setAccessible( true )
Date Sat, 08 Apr 2017 16:03:53 GMT

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.


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