Bug 143868 - [GTK] Slow to render simple page with 20.000 lines
Summary: [GTK] Slow to render simple page with 20.000 lines
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 420+
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: GLibPerformance
  Show dependency treegraph
 
Reported: 2015-04-17 02:39 PDT by Milan Crha
Modified: 2023-04-27 07:15 PDT (History)
6 users (show)

See Also:


Attachments
compressed b.html (28.63 KB, application/x-xz)
2015-04-17 02:40 PDT, Milan Crha
no flags Details
test-wk2.c (1.14 KB, text/x-log)
2015-04-17 02:43 PDT, Milan Crha
no flags Details
test-wk2.c (1.79 KB, text/c)
2015-04-17 03:42 PDT, Milan Crha
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Crha 2015-04-17 02:39:04 PDT
WebkKitGTK is very slow when rendering a simple page with 20K lines. It seems it's parsed quickly, but the rendering engine makes it down to knees. I can reproduce the slowness both with webkit1 (webkitgtk3-2.4.8-2.fc21.x86_64) and webkit2 (webkitgtk4-2.6.5-3.fc21.x86_64).
Comment 1 Milan Crha 2015-04-17 02:40:20 PDT
Created attachment 251010 [details]
compressed b.html

This is a test b.html file, which has uncompressed ~4.5MB, but it is otherwise very simple.
Comment 2 Milan Crha 2015-04-17 02:43:39 PDT
Created attachment 251011 [details]
test-wk2.c

This is a simple test program, which looks at the /tmp for the b.html file. Note that the initial view is filled within ~2 seconds (subjectively measured), but the CPU is up at 100% approximately 3-times longer (again subjectively measured).

The first line contains a command to build and run the test program.
Comment 3 Milan Crha 2015-04-17 02:46:45 PDT
(In reply to comment #2)
> ..., which looks at the /tmp for the b.html file...

Ehm, I didn't save the file before clicking "upload", thus that's not true. Correct the path before compiling. I'm sorry for that.
Comment 4 Milan Crha 2015-04-17 03:42:35 PDT
Created attachment 251013 [details]
test-wk2.c

Updated test-wk2.c with measured times.

The webkitgtk4-2.8.1-1.fc22.x86_64 shows these times:
  load_changed_cb: WEBKIT_LOAD_STARTED after 0.257252s
  load_changed_cb: WEBKIT_LOAD_COMMITTED after 0.268599s
  load_changed_cb: WEBKIT_LOAD_FINISHED after 2.59222s

while webkitgtk4-2.6.5-3.fc21.x86_64 shows:
  load_changed_cb: WEBKIT_LOAD_STARTED after 0.098319s
  load_changed_cb: WEBKIT_LOAD_COMMITTED after 0.101146s
  load_changed_cb: WEBKIT_LOAD_FINISHED after 6.49957s

thus you clearly made some improvements already.

I suggest to run the test application under callgrind:
   $ G_SLICE=always-malloc valgrind --tool=callgrind --trace-children=yes ./test-wk2

then use a tool like kcachegrind to examine the bottlenecks. I see (with the 2.6.5) 100 and 200 million-times called functions in the web process, which feels like a room for improvements, especially when the HTML document contains only 20K lines with a bit more tags in total.

I didn't run the callgrind with the 4.8.1, it's a virtual machine and there is not enough place for the debug info, without which the callgrind log is useless.
Comment 5 Kdwk 2023-04-27 02:10:41 PDT
Unable to reproduce in Gnome Web 44.2/ WebKitGTK 2.40.1. Perhaps fixed already?
Comment 6 Adrian Perez 2023-04-27 07:15:07 PDT
(In reply to kdwkleung from comment #5)
> Unable to reproduce in Gnome Web 44.2/ WebKitGTK 2.40.1. Perhaps fixed
> already?

Same here with ToT and a build from the tip of the 2.40 branch. I think
this can be closed.