The deepCopy method from the ItemCollection is the most expensive method concerning overall performance.
We can not optimize or improve this method further, but we can avoid a expensive deepCopy in many cases by replaceing
new ItemCollection(_task)
with
ItemCollection.createByReference(_task.getAllItems());
Candiates for this performance improvements are:
- BPMNModel.findAllTasks
- BPMNModel.findAllEventsByTask
- BPMNMOdel.getDefinition
- BPMNModel.getTask
- BPMNModel.getEvent
The method createByReference
public static ItemCollection createByReference(final Map<String, List<Object>> map) {
ItemCollection reference = new ItemCollection();
if (map != null) {
reference.hash = map;
}
return reference;
}
should be replaced with something like:
Map<Object, Object> mapCopy = map
.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, valueMapper -> new ArrayList<>(valueMapper.getValue())));
The deepCopy method from the ItemCollection is the most expensive method concerning overall performance.
We can not optimize or improve this method further, but we can avoid a expensive deepCopy in many cases by replaceing
with
Candiates for this performance improvements are:
The method createByReference
should be replaced with something like: