[solved] QTextBrowser 's constructor takes too long. Qt 5.2
-
@
struct timeval start, end;
gettimeofday( &start, NULL );QTextBrowser *browser = new QTextBrowser(this); gettimeofday( &end, NULL ); int timeuse = 1000000 * ( end.tv_sec - start.tv_sec ) + end.tv_usec - start.tv_usec; printf("time: %d us %.2f ms %.2f s\n", timeuse, timeuse / 1000.0f, timeuse / 1000000.0f);
@
time: 2096293 us 2096.29 ms 2.10 s
Qt 5.3 is better now
@time: 31103 us 31.10 ms 0.03 s@ -
It is fast in Qt 4.8.4 ..
-
Hi,
You need to give more information like your OS.
When are you instantiating this QTextBrowser ?
Are you doing anything in the background ? etc.You can also have a look at the "bug report system":http://bugreports.qt-project.org to see if someone already mentioned that performance change.
-
[quote author="SGaist" date="1396367015"]Hi,
You need to give more information like your OS.
When are you instantiating this QTextBrowser ?
Are you doing anything in the background ? etc.You can also have a look at the "bug report system":http://bugreports.qt-project.org to see if someone already mentioned that performance change.[/quote]
Qt5.2.1
OSX 10.9.2
3.2 GHz Intel Core i5main.cpp
@
#include <QApplication>
#include <QTextBrowser>
#include <sys/time.h>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
struct timeval start, end;
::gettimeofday( &start, NULL );QTextBrowser *browser = new QTextBrowser(); gettimeofday( &end, NULL ); int timeuse = 1000000 * ( end.tv_sec - start.tv_sec ) + end.tv_usec - start.tv_usec; printf("time: %d us %.2f ms %.2f s\n", timeuse, timeuse / 1000.0f, timeuse / 1000000.0f); fflush(0); browser->show(); return a.exec();
}
@time: 805963 us 805.96 ms 0.81 s
-
Are you also running 4.8.4 on 10.9.2 ?
-
Qt4.8.5
OSX 10.9.2
3.2 GHz Intel Core i5time: 2000 us 2.00 ms 0.00 s
[quote author="SGaist" date="1396737630"]Are you also running 4.8.4 on 10.9.2 ?[/quote]
-
So 5.2.1 is better but not as fast. There's currently 5.3 that's almost out. Can you do the test again with that one ?
-
Ok, you win.
Qt 5.3.0-beta downloads a day.
@
time: 31103 us 31.10 ms 0.03 s
@5.3.0 is better than 5.2.1, but slower than 4.8.5.
It is enough, hope it better. ;)
[quote author="SGaist" date="1398114805"]So 5.2.1 is better but not as fast. There's currently 5.3 that's almost out. Can you do the test again with that one ?[/quote]
-
Just to be on the safe side, there's also 4.8.6 coming out. You could try this one to see if performance changes (should not) In the case it is, then there's a regression somewhere