[go: up one dir, main page]

Accelerate deselect etc path operations by using std::deque instead of std::list

Change SPCanvasGroup::items to use std::deque instead of std::list, because linked list becomes exceedingly slow with large path sets. This is evident for example in "path deselect" operation that this change accelerates remarkably.

The performance-critical operations of SPCanvasGroup::items are random seek and random removal of nodes, and in such use std::deque works faster than std::list or std::vector, see e.g. following link for c++ list-vs-deque-vs-vector comparison: https://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html

However, also deque becomes bottleneck with very large path sets so ideally this structure would be refactored to use map or set instead of list-based structure. Such change will require rethinking how to arrange the mutual Z order of canvas items.

Signed-off-by: Olli Parviainen oparviai@iki.fi

Merge request reports

Loading