Performance improvements

- Use larger buffer size when writing uncompressed files
  (was libcurl's default of 16 kb, change it to 128 kb)
- Uncompress the next MB of data, while it is hashing/writing to
  disk in seperate thread.
This commit is contained in:
Floris Bos 2020-03-10 23:22:20 +01:00
parent bd37916527
commit 0264af9b73
7 changed files with 57 additions and 20 deletions

View file

@ -104,6 +104,11 @@ public:
*/
void setCacheFile(const QString &filename, qint64 filesize = 0);
/*
* Set input buffer size
*/
void setInputBufferSize(int len);
/*
* Thread safe download progress query functions
*/
@ -114,6 +119,7 @@ public:
uint64_t bytesWritten();
virtual bool isImage();
size_t _writeFile(const char *buf, size_t len);
signals:
void success();
@ -126,7 +132,7 @@ protected:
virtual void _onDownloadSuccess();
virtual void _onDownloadError(const QString &msg);
size_t _writeFile(const char *buf, size_t len);
void _hashData(const char *buf, size_t len);
void _writeComplete();
bool _verify();
int _authopen(const QByteArray &filename);
@ -155,6 +161,7 @@ protected:
bool _cancelled, _successful, _verifyEnabled, _cacheEnabled;
time_t _lastModified, _serverTime, _lastFailureTime;
QElapsedTimer _timer;
int _inputBufferSize;
#ifdef Q_OS_WIN
WinFile _file, _volumeFile;