Thursday, February 22, 2018

On Compiling WebKit (Now Twice As Fast!)

Michael Catanzaro:

The approach is pretty simple: instead of telling the compiler to build the original C++ source code files that developers see, we instead tell the compiler to build unified source files that look like this:

// UnifiedSource1.cpp
#include "CSSValueKeywords.cpp"
#include "ColorData.cpp"
#include "HTMLElementFactory.cpp"
#include "HTMLEntityTable.cpp"
#include "JSANGLEInstancedArrays.cpp"
#include "JSAbortController.cpp"
#include "JSAbortSignal.cpp"
#include "JSAbstractWorker.cpp"

Since files are included only once per translation unit, we now have to parse the same headers only once for each unified source file, rather than for each individual original source file, and we get a dramatic build speedup. It’s pretty terrible, yet extremely effective.

1 Comment RSS · Twitter

Oh thank goodness!!!! I have a program on my Antergos (Arch Linux based distro) laptop that requires webkitgtk. Every time I see an update, I audibly groan and visibly slump down.... it takes forever to build.

From the Arch Linux package page:

Building takes too long time!

A: WebKit is inherently big and complex. It can take up to 13.5 hours to build (on AMD Athlon X2, thanks to @Bonnietwin for sharing). You can modify makepkg.conf or PKGBUILD directly to build it in parallel. Check out @MadMe's and @tuxsavvy's comments.

No kidding!!!!

While there is a prebuilt package from the Arch Linux China team, I always figure it's easier to just let it build. But after three builds, no it was not, not on a house, not with a mouse, not with a fox, no wearing sox. Hopefully this really will speed up the build times! Fingers crossed.

Leave a Comment