Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Optimise QgsFeature::setAttributes
Remove the equality check "shortcut". Profiling shows that the cost
of checking the equality of the attributes well exceeds the cost
of cost always detaching the feature. And in the vast majority of
cases the equality operator would return false anyway, resulting
in a lot of wasted effort.
  • Loading branch information
nyalldawson committed May 9, 2023
1 parent e33996d commit c870269
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/core/qgsfeature.cpp
Expand Up @@ -159,9 +159,6 @@ int QgsFeature::attributeCount() const

void QgsFeature::setAttributes( const QgsAttributes &attrs )
{
if ( attrs == d->attributes )
return;

d.detach();
d->attributes = attrs;
d->valid = true;
Expand Down

0 comments on commit c870269

Please sign in to comment.