Commit edafc8b9 authored by Scott Wheeler's avatar Scott Wheeler

About another 30% faster on load (again, for large lists), plus faster on

sort.  Instead of caching the output of QString::lower() go a level
deeper in the string comparison logic and cache the value of
QString::local8Bit().  I think this is about as fast as it's going to get
for the moment, but it's now down to 4.8 seconds (on my machine) for 12,000
items -- compared to 94 s when I started profiling with this data set.

svn path=/trunk/kdemultimedia/juk/; revision=242706
parent 73cbd94a
......@@ -277,10 +277,9 @@ int PlaylistItem::compare(const PlaylistItem *firstItem, const PlaylistItem *sec
return 0;
}
}
else {
previousResult = firstItem->data()->lower(column).localeAwareCompare(secondItem->data()->lower(column));
return previousResult;
}
else
return strcoll(firstItem->data()->local8BitLower(column),
secondItem->data()->local8BitLower(column));
}
bool PlaylistItem::isValid() const
......@@ -317,9 +316,9 @@ void PlaylistItem::slotRefreshImpl()
setText(CommentColumn + offset, shortComment);
int columns = listView()->columns();
m_data->resizeLower(columns);
m_data->setColumns(columns);
for(int i = 0; i < columns; i++)
m_data->setLower(i, text(i).lower());
m_data->setLocal8BitLower(i, text(i).lower().local8Bit());
}
void PlaylistItem::slotTagGuessResults(const MusicBrainzQuery::TrackList &res)
......
......@@ -184,9 +184,9 @@ public:
QString absFilePath() const { return m_absFileName; }
void resizeLower(int size) { m_lower.resize(size); }
void setLower(int column, const QString &value) { m_lower[column] = value; }
QString lower(int column) const { return m_lower[column]; }
void setColumns(int columns) { m_local8Bit.resize(columns); }
void setLocal8BitLower(int column, const QCString &value) { m_local8Bit[column] = value; }
QCString local8BitLower(int column) const { return m_local8Bit[column]; }
protected:
/**
......@@ -204,7 +204,7 @@ private:
int m_referenceCount;
Tag *m_dataTag;
QString m_absFileName;
QValueVector<QString> m_lower;
QValueVector<QCString> m_local8Bit;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment