Created
October 30, 2011 20:40
-
-
Save mnutt/1326410 to your computer and use it in GitHub Desktop.
benchmark QImage save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtGui> | |
#include <QTimer> | |
int | |
main(int argc, char *argv[]) { | |
int times = 1000; | |
QString format("png"); | |
QByteArray ba; | |
QBuffer* buffer = new QBuffer(&ba); | |
buffer->open(QIODevice::WriteOnly); | |
QTime timer; | |
timer.start(); | |
while(times--) { | |
QImage image(800, 800, QImage::Format_RGB32); | |
image.save(buffer, format.toAscii(), -1); | |
} | |
int elapsed = timer.elapsed(); | |
qDebug() << "Completed 1000 runs in" << elapsed << "ms. (" << (elapsed / 1000) << "ms / render )"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment