Thomas Heigl created WICKET-6830:
------------------------------------

             Summary: 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
         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 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}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to