diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2018-11-06 11:48:13 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2018-11-15 09:26:44 +0300 |
commit | b557aab09de8c39a425ebf874e54929e9ad66b13 (patch) | |
tree | 2bc1e766af880823cc7bf7e49227dc2f169a4092 /test/syncenginetestutils.h | |
parent | baa241f26b565cb514d100f4b5488cf05aa99f72 (diff) |
Test System: Optimisations so the benchmark is significant
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r-- | test/syncenginetestutils.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index ab2b2777d..48a380d5e 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -58,7 +58,8 @@ public: PathComponents parentDirComponents() const { return PathComponents{mid(0, size() - 1)}; } - PathComponents subComponents() const { return PathComponents{mid(1)}; } + PathComponents subComponents() const& { return PathComponents{mid(1)}; } + PathComponents subComponents() && { removeFirst(); return std::move(*this); } QString pathRoot() const { return first(); } QString fileName() const { return last(); } }; @@ -250,7 +251,7 @@ public: file->lastModified = modTime; } - FileInfo *find(const PathComponents &pathComponents, const bool invalidateEtags = false) { + FileInfo *find(PathComponents pathComponents, const bool invalidateEtags = false) { if (pathComponents.isEmpty()) { if (invalidateEtags) etag = generateEtag(); @@ -259,7 +260,7 @@ public: QString childName = pathComponents.pathRoot(); auto it = children.find(childName); if (it != children.end()) { - auto file = it->find(pathComponents.subComponents(), invalidateEtags); + auto file = it->find(std::move(pathComponents).subComponents(), invalidateEtags); if (file && invalidateEtags) // Update parents on the way back etag = file->etag; @@ -319,7 +320,7 @@ public: bool isDir = true; bool isShared = false; OCC::RemotePermissions permissions; // When uset, defaults to everything - QDateTime lastModified = QDateTime::currentDateTime().addDays(-7); + QDateTime lastModified = QDateTime::currentDateTimeUtc().addDays(-7); QString etag = generateEtag(); QByteArray fileId = generateFileId(); QByteArray checksums; @@ -332,8 +333,8 @@ public: QString parentPath; private: - FileInfo *findInvalidatingEtags(const PathComponents &pathComponents) { - return find(pathComponents, true); + FileInfo *findInvalidatingEtags(PathComponents pathComponents) { + return find(std::move(pathComponents), true); } friend inline QDebug operator<<(QDebug dbg, const FileInfo& fi) { |