Skip to content

Performance improvements #697

@rsoika

Description

@rsoika

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())));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions