Bug 38386 - [Qt] QWebView::load performance issue on Windows compared to Linux
Summary: [Qt] QWebView::load performance issue on Windows compared to Linux
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC Windows 7
: P3 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-04-30 04:45 PDT by Guillaume LACHAUD
Modified: 2014-01-29 07:45 PST (History)
6 users (show)

See Also:


Attachments
Demonstration (357.86 KB, application/x-zip-compressed)
2010-04-30 04:45 PDT, Guillaume LACHAUD
no flags Details
Profile (176.71 KB, application/octet-stream)
2010-05-07 07:18 PDT, Guillaume LACHAUD
no flags Details
Flat profile and call graph (7.49 KB, text/plain)
2010-05-07 07:29 PDT, Guillaume LACHAUD
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume LACHAUD 2010-04-30 04:45:36 PDT
Created attachment 54792 [details]
Demonstration

Loading this page (http://fr.kingofsat.net/pos-13E.php) and any of this site is MUCH longer on Windows than on Linux. When loading on Windows it takes about 7~8 seconds, takes 100%cp and freezes sometimes for a few seconds. At the contrary on Linux it only takes 3~4 seconds. The same page loads fast on Konqueror and Chrome but is also problematic on Aurora. Even if I try to load this page in Widget-less application the problem is the same.
Please find attached a little demonstration : it load the page and then warn about the time it took.

Tested with QT 4.6 and QT 4.7,  under Windows 7 Pro 64 bits, Windows Vista Home 32 bits, Windows Xp Pro 32 bits and Linux Kubuntu 9.10 64 bits

Thanks to investigate
Comment 1 Guillaume LACHAUD 2010-05-04 15:27:01 PDT
I have made one other test : I have copied the contents of the page that is slow to load in a file. Then I use QFile to load the contents and setHtml to fill the WebPage with the contents. And the problem is still here, twice faster on Linux than on Windows. It seems that the problem is in the way this page is interpreted.

Thanks
Comment 2 Guillaume LACHAUD 2010-05-07 04:51:39 PDT

*** This bug has been marked as a duplicate of bug 31719 ***
Comment 3 Benjamin Poulain 2010-05-07 05:02:38 PDT
Not a duplicate if you can reproduce the issue with the beta of Qt 4.7.
Could you please attach a profile on Windows?
Comment 4 Guillaume LACHAUD 2010-05-07 05:12:25 PDT
I am able to reproduce the problem with 4.7 technical preview, I have not tested with the beta.
Comment 5 Benjamin Poulain 2010-05-07 05:47:32 PDT
(In reply to comment #4)
> I am able to reproduce the problem with 4.7 technical preview, I have not
> tested with the beta.

Ok, the "technical preview" still have the old WebKit. Please try with a recent WebKit then (WebKit trunk for example).
Comment 6 Guillaume LACHAUD 2010-05-07 06:17:34 PDT
I have just tested with 4.7 beta and it is not solved in that version. I will try the latest qtwebkit if I find out how to install it (I don't want to compile the whole qt libraries)
Comment 7 Benjamin Poulain 2010-05-07 06:21:06 PDT
(In reply to comment #6)
> I have just tested with 4.7 beta and it is not solved in that version. I will
> try the latest qtwebkit if I find out how to install it (I don't want to
> compile the whole qt libraries)

Here it is: http://trac.webkit.org/wiki/BuildingQtOnWindows

A profile would be welcome. We are aware of slowness with fonts layout on Windows.
Comment 8 Guillaume LACHAUD 2010-05-07 06:41:37 PDT
OK I'll try to build latest qtwebkit as from what I can see on the jounral, the 31719 as only be included in this week's release. But I thought I could use the latest version by downloading the binary. I don't understand what you mean with "profile".

Thanks
Comment 9 Benjamin Poulain 2010-05-07 06:56:01 PDT
(In reply to comment #8)
> I don't understand what you mean with
> "profile".

You can run your example in your favorite profiler and send the list of function used ordered by time spent in them.
Comment 10 Benjamin Poulain 2010-05-07 07:01:37 PDT
(In reply to comment #9)
> You can run your example in your favorite profiler and send the list of
> function used ordered by time spent in them.

I had a look on Linux. Most of the time is spend loading the resources.

CPU wise, a ridiculous amount of time is spent in layouting of the text. But time-wise, 99% of the time is spend loading the images of the page.
Comment 11 Guillaume LACHAUD 2010-05-07 07:18:25 PDT
Created attachment 55371 [details]
Profile
Comment 12 Guillaume LACHAUD 2010-05-07 07:18:56 PDT
I have attached the profile established on Windows 7 x64 with Qt 4.7 beta1
Comment 13 Benjamin Poulain 2010-05-07 07:23:54 PDT
(In reply to comment #12)
> I have attached the profile established on Windows 7 x64 with Qt 4.7 beta1

Could you please upload a text file with the result instead? The file you sent depends on the exact binary that was used to generate it. You can use the command gprof to generate the results.
Comment 14 Benjamin Poulain 2010-05-07 07:24:41 PDT
Adding Jocelyn and Andreas to the bug report.
Comment 15 Guillaume LACHAUD 2010-05-07 07:29:31 PDT
Created attachment 55372 [details]
Flat profile and call graph

I am not sure if this is relevant as every call is 0% of time
Comment 16 Benjamin Poulain 2010-05-07 07:37:16 PDT
(In reply to comment #15)
> I am not sure if this is relevant as every call is 0% of time

Hum, not, that is not a correct profile.
Jocelyn, what do you use on Windows?

Note that you have qt_noop() in the function list, so either you have a problem with your compiler, or you are running a debug build. If the latter, you should start by testing in release mode.
Comment 17 Guillaume LACHAUD 2010-05-07 07:45:34 PDT
Sorry, I have never used a profiler on Windows (I use Valgrind under Linux). I have seen here http://www.qtcentre.org/wiki/index.php?title=Profiling_with_GNU_gprof that I had to build it in debug.
Comment 18 Jocelyn Turcotte 2010-05-10 01:47:47 PDT
(In reply to comment #16)
> Hum, not, that is not a correct profile.
> Jocelyn, what do you use on Windows?
> 
I couldn't get any decent profiler work with webkit on my windows 7 64 machine without crashing. I should try again with JIT disabled some day.
I ended up using poor man sampling profilers like VerySleepy or ProcessMonitor.

(In reply to comment #0)
The problem is that Windows fonts contains OpenType layout information and they don't on Linux. When a font of this type is encountered a different path is taken in text rendering taking near twice as much time.

I don't know if any mandatory process is done in this path for regular fonts like Arial on Windows. Maybe it would be possible to skip it in some case even if the font reports supporting it.

Implementing in QtWebKit the "fast path" for regular ascii files that other ports did would also help, however this can't be done short term.
Comment 19 Guillaume LACHAUD 2010-05-10 02:39:22 PDT
I haven't been unable to compile latest webkit trunk. After two hours of compilation, I've got a few linking errors with undefined references.

Anyway, Using Qt 4.7 beta1 I can notice improvements since 4.6.2 but still not as fast as on Linux. In fact, I do not display the webpages, they are just parsed. So maybe the font problem could be avoided.
Comment 20 Benjamin Poulain 2010-05-10 02:43:10 PDT
(In reply to comment #19)
> I do not display the webpages, they are just parsed. So maybe the font problem could be avoided.

You probably need the layout of the page to be valid?

If yes, WebKit need to find the width of each words to break the text in block and this require some "heavy" computation with the fonts.
Comment 21 Guillaume LACHAUD 2010-05-10 02:45:12 PDT
All I need is the source code and to be able to use QWebElement
Comment 22 Strahinja Markovic 2010-05-10 05:58:47 PDT
(In reply to comment #18) 
> I couldn't get any decent profiler work with webkit on my windows 7 64 machine without crashing. I should try again with JIT disabled some day.
> I ended up using poor man sampling profilers like VerySleepy or ProcessMonitor.

Jocelyn, have you seen my latest comments on bug 31719? I've attached some detailed profile data there created with the AQtime profiler.