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

Separate model, behaviors and metadata into separate fields

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.0.0-M5
    • Fix Version/s: None
    • Component/s: wicket-core
    • Labels:
      None

      Description

      While investigating performance issues with metadata in WICKET-6771, I discovered that significant performance gains can be achieved by separating models, behaviors, and metadata into separate fields.

      Currently, all three types of data are stored in a single, untyped field Component.data. The idea is to minimize memory overhead by creating as few objects as possible.

      If a model or a single behavior or metadata is added, data stores only a reference to the object. When additional data is added, the reference becomes an array.

      This is the most memory-efficient way to store these three types of data. But it comes with a cost: code to manipulate that data structure is complex and not as efficient because it has to take all possible combinations of data into account.

      I suggest introducing 3 separate fields for the 3 types of data, trading a little bit of memory for reduced complexity and performance gains.

        Attachments

        1. benchmarks.png
          318 kB
          Thomas Heigl
        2. ComponentBenchmarks.java
          5 kB
          Thomas Heigl
        3. ComponentBenchmarks.java
          12 kB
          Emond Papegaaij

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thomas.heigl Thomas Heigl
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: