diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-28 22:29:35 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-28 22:29:35 +0200 |
commit | a24bf3db83d81d7d7677a1f0f750f208d32998a8 (patch) | |
tree | 0d3fa9da24d706c2e6b03e8bf0fd74a434ae871f /common/datastorequery.cpp | |
parent | 683ee2ec1d198a9f19572e42d78fa0b9939d7f10 (diff) | |
download | sink-a24bf3db83d81d7d7677a1f0f750f208d32998a8.tar.gz sink-a24bf3db83d81d7d7677a1f0f750f208d32998a8.zip |
Avoid unnecessary Identifier conversions in performance ciritical code.
This fixes the performance regressions to a state where we are roughly
at the same performance as pre Identifier (but not any better either).
Diffstat (limited to 'common/datastorequery.cpp')
-rw-r--r-- | common/datastorequery.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp index 52243da..43b4660 100644 --- a/common/datastorequery.cpp +++ b/common/datastorequery.cpp | |||
@@ -46,14 +46,10 @@ class Source : public FilterBase { | |||
46 | QVector<Identifier> mIncrementalIds; | 46 | QVector<Identifier> mIncrementalIds; |
47 | QVector<Identifier>::ConstIterator mIncrementalIt; | 47 | QVector<Identifier>::ConstIterator mIncrementalIt; |
48 | 48 | ||
49 | Source (const QVector<QByteArray> &ids, DataStoreQuery *store) | 49 | Source (const QVector<Identifier> &ids, DataStoreQuery *store) |
50 | : FilterBase(store), | 50 | : FilterBase(store), |
51 | mIds() | 51 | mIds(ids) |
52 | { | 52 | { |
53 | mIds.reserve(ids.size()); | ||
54 | for (const auto &id : ids) { | ||
55 | mIds.append(Identifier::fromDisplayByteArray(id)); | ||
56 | } | ||
57 | mIt = mIds.constBegin(); | 53 | mIt = mIds.constBegin(); |
58 | } | 54 | } |
59 | 55 | ||
@@ -614,7 +610,11 @@ void DataStoreQuery::setupQuery(const Sink::QueryBase &query_) | |||
614 | mSource = [&]() { | 610 | mSource = [&]() { |
615 | if (!query.ids().isEmpty()) { | 611 | if (!query.ids().isEmpty()) { |
616 | //We have a set of ids as a starting point | 612 | //We have a set of ids as a starting point |
617 | return Source::Ptr::create(query.ids().toVector(), this); | 613 | QVector<Identifier> ids; |
614 | for (const auto & id: query.ids()) { | ||
615 | ids.append(Identifier::fromDisplayByteArray(id)); | ||
616 | } | ||
617 | return Source::Ptr::create(ids, this); | ||
618 | } else { | 618 | } else { |
619 | QSet<QByteArrayList> appliedFilters; | 619 | QSet<QByteArrayList> appliedFilters; |
620 | auto resultSet = mStore.indexLookup(mType, query, appliedFilters, appliedSorting); | 620 | auto resultSet = mStore.indexLookup(mType, query, appliedFilters, appliedSorting); |