[
https://issues.apache.org/jira/browse/WICKET-6774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17096498#comment-17096498
]
Thomas Heigl commented on WICKET-6774:
--------------------------------------
[~papegaaij]: I extended my benchmark and ran it against your branch and the
master. Your branch is significantly faster for the case with only metadata,
but slightly slower for the other cases.
Master:
||Benchmark || Mode ||
Cnt || Score || Error || Units||
|ComponentBenchmarks.detachComponent | thrpt | 20
| 15528,367 |± 32,690 | ops/s|
|ComponentBenchmarks.detachComponentWithMetaData | thrpt | 20
|10236,115 |± 95,023 | ops/s|
|ComponentBenchmarks.detachComponentWithMetaDataAndModel | thrpt | 20
| 4139,486 |± 7,065| ops/s|
|ComponentBenchmarks.detachComponentWithMetaDataModelAndBehavior | thrpt | 20
| 3260,999 | ± 21,927 | ops/s|
Your branch:
||Benchmark || Mode ||
Cnt || Score || Error ||Units||
|ComponentBenchmarks.detachComponent | thrpt |
20| 14142,217 | ± 786,319 | ops/s|
|ComponentBenchmarks.detachComponentWithMetaData | thrpt |
20 | 13448,754 | ± 75,604 | ops/s|
|ComponentBenchmarks.detachComponentWithMetaDataAndModel | thrpt|
20| 3292,400| ± 11,846 | ops/s|
|ComponentBenchmarks.detachComponentWithMetaDataModelAndBehavior | thrpt |
20 | 2644,336| ± 10,262| ops/s|
I guess the only way to further improve the performance without changing the
data structure is to add flags for {{METADATA_SET}} and {{BEHAVIOR_SET}} and
return early if these are not set.
> 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: Major
>
> 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.3.4#803005)