Speed optimization for method VPattern::ElementsToParse().
--HG-- branch : develop
This commit is contained in:
parent
a91b1a3816
commit
114bdfe9dd
|
@ -64,6 +64,7 @@
|
||||||
#include <QtNumeric>
|
#include <QtNumeric>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QtConcurrentMap>
|
||||||
|
|
||||||
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
|
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
|
||||||
|
|
||||||
|
@ -74,6 +75,12 @@ QString FileComment()
|
||||||
{
|
{
|
||||||
return QString("Pattern created with Valentina v%1 (https://valentinaproject.bitbucket.io/).").arg(APP_VERSION_STR);
|
return QString("Pattern created with Valentina v%1 (https://valentinaproject.bitbucket.io/).").arg(APP_VERSION_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void GatherCount(int &count, const int nodes)
|
||||||
|
{
|
||||||
|
count += nodes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -534,17 +541,16 @@ void VPattern::RefreshCurves()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VPattern::ElementsToParse() const
|
int VPattern::ElementsToParse() const
|
||||||
{
|
{
|
||||||
int count = elementsByTagName(TagArc).length();
|
QVector<QString> tags({TagArc, TagDetail, TagElArc, TagLine, TagSpline, TagOperation, TagPath, TagPoint,
|
||||||
count += elementsByTagName(TagDetail).length();
|
TagTools, TagIncrement
|
||||||
count += elementsByTagName(TagElArc).length();
|
});
|
||||||
count += elementsByTagName(TagLine).length();
|
|
||||||
count += elementsByTagName(TagSpline).length();
|
std::function<int (const QString &tagName)> TagsCount = [this](const QString &tagName)
|
||||||
count += elementsByTagName(TagOperation).length();
|
{
|
||||||
count += elementsByTagName(TagPath).length();
|
return elementsByTagName(tagName).length();
|
||||||
count += elementsByTagName(TagPoint).length();
|
};
|
||||||
count += elementsByTagName(TagTools).length();
|
|
||||||
count += elementsByTagName(TagIncrement).length();
|
return QtConcurrent::blockingMappedReduced(tags, TagsCount, GatherCount);
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user