summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-10-27 15:42:14 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-10-28 09:15:19 +0000
commit002b2e15d05a1a6784595855408c331531f03746 (patch)
tree53014a63686fc03f826423ea3debf41fb63a1e1f
parent8bd9037a6be6dbea7940ac54b4aba9ec3df4b732 (diff)
LibArchiveWrapper: use local zero-timer for processing server signals
Now that the server process may request file seeks in addition to reads for archive formats supporting them, the interval which we process the requests will have a big impact on the extracting speed. Also shrink the read buffer as its size isn't as significant for the performance after this change. Task-number: QTIFW-2384 Change-Id: Iaf296833c6ff1acfc666a6e82f661e1a40c77b61 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/libarchivewrapper_p.cpp15
-rw-r--r--src/libs/installer/libarchivewrapper_p.h1
2 files changed, 7 insertions, 9 deletions
diff --git a/src/libs/installer/libarchivewrapper_p.cpp b/src/libs/installer/libarchivewrapper_p.cpp
index 75bbddbe8..30f81554a 100644
--- a/src/libs/installer/libarchivewrapper_p.cpp
+++ b/src/libs/installer/libarchivewrapper_p.cpp
@@ -77,7 +77,6 @@ LibArchiveWrapperPrivate::LibArchiveWrapperPrivate()
*/
LibArchiveWrapperPrivate::~LibArchiveWrapperPrivate()
{
- m_timer.stop();
}
/*!
@@ -140,6 +139,10 @@ QString LibArchiveWrapperPrivate::errorString() const
bool LibArchiveWrapperPrivate::extract(const QString &dirPath, const quint64 totalFiles)
{
if (connectToServer()) {
+ QTimer timer;
+ connect(&timer, &QTimer::timeout, this, &LibArchiveWrapperPrivate::processSignals);
+ timer.start();
+
m_lock.lockForWrite();
callRemoteMethod(QLatin1String(Protocol::AbstractArchiveExtract), dirPath, totalFiles);
m_lock.unlock();
@@ -148,6 +151,7 @@ bool LibArchiveWrapperPrivate::extract(const QString &dirPath, const quint64 tot
connect(this, &LibArchiveWrapperPrivate::remoteWorkerFinished, &loop, &QEventLoop::quit);
loop.exec();
}
+ timer.stop();
return (workerStatus() == ExtractWorker::Success);
}
return m_archive.extract(dirPath, totalFiles);
@@ -262,7 +266,7 @@ void LibArchiveWrapperPrivate::processSignals()
*/
void LibArchiveWrapperPrivate::onDataBlockRequested()
{
- constexpr quint64 blockSize = 10 * 1024 * 1024; // 10MB
+ constexpr quint64 blockSize = 1024 * 1024; // 1MB
QFile *const file = &m_archive.m_data->file;
if (!file->isOpen() || file->isSequential()) {
@@ -327,15 +331,10 @@ void LibArchiveWrapperPrivate::onSeekRequested(qint64 offset, int whence)
}
/*!
- Starts the timer to process server-side signals and connects handler
- signals for the matching signals of the wrapper object.
+ Connects handler signals for the matching signals of the wrapper object.
*/
void LibArchiveWrapperPrivate::init()
{
- m_timer.start(250);
- QObject::connect(&m_timer, &QTimer::timeout,
- this, &LibArchiveWrapperPrivate::processSignals);
-
QObject::connect(&m_archive, &LibArchiveArchive::currentEntryChanged,
this, &LibArchiveWrapperPrivate::currentEntryChanged);
QObject::connect(&m_archive, &LibArchiveArchive::completedChanged,
diff --git a/src/libs/installer/libarchivewrapper_p.h b/src/libs/installer/libarchivewrapper_p.h
index 722c91f17..4277cd4f9 100644
--- a/src/libs/installer/libarchivewrapper_p.h
+++ b/src/libs/installer/libarchivewrapper_p.h
@@ -86,7 +86,6 @@ private:
ExtractWorker::Status workerStatus() const;
private:
- QTimer m_timer;
mutable QReadWriteLock m_lock;
LibArchiveArchive m_archive;