The purpose of this task is to refactor the SortFilterProxyModel sorters and filters to improve performance code quality.
There are 3 main points to be addressed in this task:
Use delayed invalidate by default. Currently the FastExpressionSorter is using a delayed invalidate to avoid unnecessary sorting until the event queue is cleared. The same approach is available by configuration in SortFilterProxyModel. Ideally all Sorters/Filters should behave the same in terms of delaying the invalidate. I see two options: either SortFilterProxyModel should use a delayed invalidate, or enable the delayed invalidate in the sorters/filters. An investigation and profiling is needed to find the best approach.
Use a more efficient way to expose context properties to js expressions. In this PR https://github.com/status-im/status-desktop/pull/13360FastExpressionSorter was updated to reuse the same context properties when exposing model data to js expressions. A QQmlPropertyMap is used as context property and only the properties in this map are updated. The context is not changed.
Can we use a more efficient way to do deal with the 3 way comparison needed when there's multiple sorters with different priorities?
Description
Related discussions: https://github.com/status-im/SortFilterProxyModel/pull/3#pullrequestreview-1854110886 https://github.com/status-im/status-desktop/pull/13360#discussion_r1473055545
The purpose of this task is to refactor the
SortFilterProxyModel
sorters and filters to improve performance code quality.There are 3 main points to be addressed in this task:
Use delayed
invalidate
by default. Currently theFastExpressionSorter
is using a delayed invalidate to avoid unnecessary sorting until the event queue is cleared. The same approach is available by configuration inSortFilterProxyModel
. Ideally all Sorters/Filters should behave the same in terms of delaying theinvalidate
. I see two options: eitherSortFilterProxyModel
should use a delayedinvalidate
, or enable the delayedinvalidate
in the sorters/filters. An investigation and profiling is needed to find the best approach.Use a more efficient way to expose context properties to js expressions. In this PR https://github.com/status-im/status-desktop/pull/13360
FastExpressionSorter
was updated to reuse the same context properties when exposing model data to js expressions. AQQmlPropertyMap
is used as context property and only the properties in this map are updated. The context is not changed.Can we use a more efficient way to do deal with the 3 way comparison needed when there's multiple sorters with different priorities?