Thomas Heigl created WICKET-6773:
------------------------------------

             Summary: 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: 9.0.0-M5, 8.7.0
            Reporter: Thomas Heigl


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)

Reply via email to