You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Thomas Heigl (Jira)" <ji...@apache.org> on 2020/09/13 09:29:00 UTC
[jira] [Updated] (WICKET-6830) Convert Behaviors into a static
utility class to reduce allocations
[ https://issues.apache.org/jira/browse/WICKET-6830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Heigl updated WICKET-6830:
---------------------------------
Description:
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}
was:
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 expsosing 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}
> 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
> 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)