Previously, mapping old to new items was O(n^2) because each new item was compared to all old items until the corresponding one was found. This patch introduces a pre-filter to the old elements that have to be checked. Instead of comparing all old items, only the ones with the same label are compared now. This reduces the time complexity to O(n), making the tree view much more usable with many items.