[
https://issues.apache.org/jira/browse/WICKET-6830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17195987#comment-17195987
]
ASF subversion and git services commented on WICKET-6830:
---------------------------------------------------------
Commit ef6963c32086212871d0e2ef118a0bc82797f2dc in wicket's branch
refs/heads/wicket-8.x from Thomas Heigl
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=ef6963c ]
WICKET-6830 Convert `Behaviors` into a static utility class to avoid allocating
a new object on every invocation
(cherry picked from commit 887cc751158df571d5778afb61484bbb564a8309)
> Convert Behaviors into a static utility class to reduce allocations
> -------------------------------------------------------------------
>
> Key: WICKET-6830
> URL: https://issues.apache.org/jira/browse/WICKET-6830
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-core
> Affects Versions: 9.0.0
> Reporter: Thomas Heigl
> Assignee: Thomas Heigl
> Priority: Major
> Fix For: 9.1.0
>
> Attachments: image-2020-09-13-11-07-51-274.png
>
>
> Under moderate load, my application allocates hundreds of MiB a minute in
> {{Behaviors}} objects:
> !image-2020-09-13-11-07-51-274.png|width=362,height=376!
> {{Behaviors}} is a utility class to manage behaviors associated with
> components. Instead of exposing static methods, {{Behaviors}} is instantiated
> with the target component instance on every invocation. E.g.:
> {code:java}
> new Behaviors(this).onRemove(this); {code}
> This is slightly "more OO" than a static utility class, but it allocates on
> every call. This can easily happen hundreds of times per request.
> I suggest to turn {{Behaviors}} into a simple static utility class and use it
> like this:
> {code:java}
> Behaviors.onRemove(this); {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)