[ https://issues.apache.org/jira/browse/WICKET-6773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17093741#comment-17093741 ]
Thomas Heigl commented on WICKET-6773: -------------------------------------- PR: https://github.com/apache/wicket/pull/422 > Improve performance of getting behaviors for components > ------------------------------------------------------- > > Key: WICKET-6773 > URL: https://issues.apache.org/jira/browse/WICKET-6773 > Project: Wicket > Issue Type: Improvement > Components: wicket-core > Affects Versions: 8.7.0, 9.0.0-M5 > Reporter: Thomas Heigl > Priority: Major > > Another method that showed up as hot in our production profiler is > {{Behaviors.getBehaviors()}}. > I wrote a JHM benchmark and identified the problematic part of the method as > {{Collections.unmodifiableList(subset)}}. For components without behaviors > *but with* model or metadata, this method wraps an empty list in an > unmodifiable list. This seems to be extremely slow because it does not > optimize for the case of an empty list. > If we return {{Collections.emptyList()}} in this case, the throughput of the > method nearly doubles: > ||Benchmark||Score||Units|| > |BehaviorsBenchmarks.getOld|86802535,017|ops/s| > |BehaviorsBenchmarks.getNew|143565516,640|ops/s| -- This message was sent by Atlassian Jira (v8.3.4#803005)