Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6830

Convert Behaviors into a static utility class to reduce allocations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 9.0.0
    • 9.1.0, 8.10.0
    • wicket-core
    • None

    Description

      Under moderate load, my application allocates hundreds of MiB a minute in Behaviors objects:

      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.:

      new Behaviors(this).onRemove(this); 

      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:

      Behaviors.onRemove(this); 

      Attachments

        Activity

          People

            thomas.heigl Thomas Heigl
            thomas.heigl Thomas Heigl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: