Skip to content

Commit

Permalink
Microoptimise and avoid cache lookup when no sort order set
Browse files Browse the repository at this point in the history
(cherry-picked from ebee101)
  • Loading branch information
nyalldawson committed May 23, 2017
1 parent 4acc480 commit 8992eea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/attributetable/qgsattributetablefiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ bool QgsAttributeTableFilterModel::lessThan( const QModelIndex &left, const QMod
}
}

if ( mTableModel->sortCacheExpression().isEmpty() )
{
//shortcut when no sort order set
return false;
}

return qgsVariantLessThan( left.data( QgsAttributeTableModel::SortRole ),
right.data( QgsAttributeTableModel::SortRole ) );
}
Expand Down

0 comments on commit 8992eea

Please sign in to comment.