We have experienced a large CPU load impact by IndexedContainerProperty.hashCode() in our application.
It’s called each time we add new item to the container keeping CPU busy. Is that a normal behavior? If yes, is there any way to optimize it?
Items are added to TreeTable.
If this is not just an artifact from your profiler settings:
IndexedContainerProperty.hashCode() does almost nothing itself - it only calls itemId.hashCode() and propertyId.hashCode(). I suspect that one of these types has an expensive hashCode() method, and it shows up in your profiler as time in ICP.hashCode() as it gets inlined here by the JVM.
Check also the number of calls and where they come from - is one caller dominating the number of calls?
Finally: If adding a lot of items at once, it might make sense to do it before attaching the container to the component, as far fewer notifications about changes need to be processed by the component in that case. Using some container designed to be hierarchical instead of an IndexedContainer that gets wrapped in a ContainerHierarchicalWrapper or a HierarchicalContainerOrderedWrapper might also help.