<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Curb dependency header inclusions"
   href="https://bugs.webkit.org/show_bug.cgi?id=162966">162966</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GTK] Curb dependency header inclusions
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zan&#64;falconsigh.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=290704&amp;action=diff" name="attach_290704" title="WIP">attachment 290704</a> <a href="attachment.cgi?id=290704&amp;action=edit" title="WIP">[details]</a></span>
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 &quot;it's just bindings code being large&quot;. 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 &quot;we'll save 2453 seconds in total compilation time&quot;.

So the idea is to see how far this can be curbed. GUniquePtr.h and GUniquePtrSoup.h seem the biggest culprits since they include &lt;libsoup/soup.h&gt; and &lt;gio/gio.h&gt;, respectively. Some stuff can be forward-declared, which can avoid header includes, _except_ SoupBuffer which is defined in the libsoup headers.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>