Bug 162966 - [GTK] Curb dependency header inclusions
Summary: [GTK] Curb dependency header inclusions
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-05 04:09 PDT by Zan Dobersek
Modified: 2017-03-11 11:00 PST (History)
1 user (show)

See Also:


Attachments
WIP (2.85 KB, patch)
2016-10-05 04:09 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2016-10-05 04:09:54 PDT
Created attachment 290704 [details]
WIP

During the hackfest I got pissed off at my computer taking a geological period in duration to compile WebKit. Focusing on one specific file, I dug in.

JSNavigator.cpp.o was the file I chose. It's created through the JS bindings generator, and at first I thought "it's just bindings code being large". There's more to it than that.

On the current system it takes ~5.2 seconds for Clang 3.8 to compile just that one file. Profiling the compiler didn't show much, so that was abandoned.

Looking at the dependencies for this one file though -- the list is staggering. A lot of included headers come from the standard C++ library, and a lot of the headers come from JavaScriptCore. A lot of them also come from our dependencies though -- 242 from libglib, 50 from libsoup. In total that's 292 headers out of the 1090 dependencies for this build target -- a build target that shouldn't depend on platform-specific APIs.

A small patch that removes GUniquePtrSoup.h inclusion from URL.h helps a lot in this case -- JSNavigator.cpp.o depends on 297 headers less than before. The speedup is also noticeable, it drops from ~5.2 seconds to ~4. There's 2453 build targets which include URL.h, but the improvement might not scale as simply as "we'll save 2453 seconds in total compilation time".

So the idea is to see how far this can be curbed. GUniquePtr.h and GUniquePtrSoup.h seem the biggest culprits since they include <libsoup/soup.h> and <gio/gio.h>, respectively. Some stuff can be forward-declared, which can avoid header includes, _except_ SoupBuffer which is defined in the libsoup headers.