You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (Jira)" <ji...@apache.org> on 2021/03/24 15:33:00 UTC
[jira] [Commented] (CAY-2705) Performance of callback annotation
processing
[ https://issues.apache.org/jira/browse/CAY-2705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17307935#comment-17307935 ]
Nikita Timofeev commented on CAY-2705:
--------------------------------------
Here is the refactoring: [https://github.com/apache/cayenne/commit/54d7728873ac0f0646d07a794c97f1685fe5dd93]
And here is some benchmarking results of the {{CallbackRegistry}} creation:
*3 entities*
* *4.2* 0.002 ± 0.001 ms/op
* *4.1* 0.002 ± 0.001 ms/op
*120 entities*
* *4.2* 0.147 ± 0.001 ms/op
* *4.1* 0.129 ± 0.001 ms/op
*200 entities*
* *4.2* 0.256 ± 0.001 ms/op
* *4.1* 0.230 ± 0.002 ms/op
Seems like there is no considerable degradation of the performance.
> Performance of callback annotation processing
> ---------------------------------------------
>
> Key: CAY-2705
> URL: https://issues.apache.org/jira/browse/CAY-2705
> Project: Cayenne
> Issue Type: Task
> Reporter: Andrus Adamchik
> Assignee: Nikita Timofeev
> Priority: Major
> Fix For: 4.2.B1
>
>
> Per CAY-2692 we added support for annotated callbacks on entities. This is a great feature that was requested repeatedly.
> But it looks like we overlooked the performance aspect of it (which was the reason we didn't include it in Cayenne before. See comments in CAY-1559 for instance). So we need to dig a bit deeper here, as it will affect all projects, even those that are themselves not using annotations. I see a couple of problems:
> * (minor refactoring needed) Class.getDeclaredMethods is called first in EntityResolver.initCallbacks() and the in inner loop inside CallbackOnEntity, even though we already know the method).
> * (major concern) Eagerly scanning the entire mapped class hierarchy was very slow in the past. One of Cayenne advantages is fast startup. This may have a major impact on this. So let's profile a sufficiently large model with "wide" classes with lots of properties and see how bad it is.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)