[ 
https://issues.apache.org/jira/browse/WICKET-6774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111857#comment-18111857
 ] 

ASF subversion and git services commented on WICKET-6774:
---------------------------------------------------------

Commit 8c5407b2eea79f8af95bd41d85312e82ffd45bbb in wicket's branch 
refs/heads/wicket-6774 from Emond Papegaaij
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=8c5407b2ee ]

WICKET-6774: benchmark the empty and populated model paths separately

getDefaultModel() behaves differently depending on whether a model is actually
there, and only the populated case was being measured. Inferring the empty case
by subtracting the all-model array from the mixed array is not valid: the arrays
differ in length and in the types seen at the unpacking call site, and doing so
pointed an investigation at the wrong cause. Reading each case from its own
array instead:

    readModelAllHaveModel   only shapes that carry a model
    readModelNoneHaveModel  only shapes that do not

Each read benchmark also gets a baseline twin that walks the same array with the
same blackhole and reads a plain field, so the loop and blackhole overhead can
be subtracted and what is left is the accessor. That overhead is a large part of
these numbers: over eleven components it is roughly 4ns of a 12ns measurement.

The README gains the two things that cost the most time to learn: measure a case
rather than deriving it from others, and set the fork heap deliberately. Too
large is machine dependent, too small is GC noise - the render benchmark reports
274 +- 437 us/op in 1GB and 102 +- 2 us/op in 4GB.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>


> Separate model, behaviors and metadata into separate fields
> -----------------------------------------------------------
>
>                 Key: WICKET-6774
>                 URL: https://issues.apache.org/jira/browse/WICKET-6774
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 9.0.0-M5
>            Reporter: Thomas Heigl
>            Priority: Minor
>         Attachments: ComponentBenchmarks.java, ComponentBenchmarks.java, 
> benchmarks.png
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to