Commit d84e301
committed
[Build Speed] Break up DocumentInlines.h
rdar://161694748
https://bugs.webkit.org/show_bug.cgi?id=299920
Reviewed by Ryosuke Niwa.
Prior to this patch, DocumentInlines.h was the most expensive header used in
WebCore; it is included 303 times in a WebCore Unified build, and on this
machine, each include of that file too the compile on average 1.5s to parse, for
a total of 8m CPU minutes of time spent parsing this header.
To diagnose why this header is so expensive, I commented out all the
implementations from the body of this header and ran a compile, collecting a
list of all the errors encountered. I then collected the counts of each error
message, and grouped liked errors together. It became clear that most uses of
DocumentInlines.h were to pull in a very narrow set of inlined methods, but
to get those few methods had to include a very large and very heavy header.
To address this, DocumentInlines.h was broken up into separate headers, each
which includes only Document.h and one or two other headers. Usually the second
header was required to define the return type of the method, and the type
definition is required because the return type is a CheckedPtr or RefPtr.
However because the return value is typically used at the call site, that return
value header would have been included already, meaning this style of header has
zero effective additional cost.
The files were created in descending order of the number of uses:
- DocumentView.h - 187
- DocumentPage.h - 175
- DocumentQuirks.h - 84
- DocumentSecurityOrigin.h - 54
- DocumentResourceLoader.h - 49
- DocumentMarkers.h - 27
- DocumentEventLoop.h - 26
- DocumentSettingsValues.h - 23
- DocumentWindow.h - 19
The remaining grab-bag of inlined methods had less than 10 uses each and were
left in DocumentInlines.h.
After this patch, DocumentInlines.h is used in just over 100 implementation
files and no headers. None of the new Document*.h headers or DocumentInlines.h
appear in the top 100 most expensive header files. DocumentInlines.h dropped
from the #1 most expensive header taking 8m to parse to #389 and 5.7s of
parsing. The most expensive new header is DocumentPage.h at #124 and 25s of
parsing.
Canonical link: https://commits.webkit.org/300989@main1 parent ac8c421 commit d84e301
611 files changed
Lines changed: 1421 additions & 990 deletions
File tree
- Source
- WebCore
- Modules
- ShapeDetection
- applepay-ams-ui
- applepay
- applicationmanifest
- async-clipboard
- audiosession
- beacon
- cache
- contact-picker
- cookie-consent
- cookie-store
- credentialmanagement
- encryptedmedia
- entriesapi
- fetch
- gamepad
- geolocation
- highlight
- identity
- indexeddb
- mediacapabilities
- mediacontrols
- mediarecorder
- mediasession
- mediasource
- mediastream
- libwebrtc
- model-element
- notifications
- permissions
- push-api
- screen-wake-lock
- speech
- webaudio
- webauthn
- webdatabase
- webdriver
- websockets
- webxr
- SaferCPPExpectations
- WebCore.xcodeproj
- accessibility
- atspi
- ios
- isolatedtree
- mac
- playstation
- win
- animation
- bindings
- js
- scripts
- test/JS
- contentextensions
- css
- parser
- query
- typedom
- dom
- mac
- editing
- cocoa
- glib
- ios
- mac
- fileapi
- history
- html
- canvas
- closewatcher
- parser
- shadow
- track
- inspector
- agents
- page
- layout/integration/grid
- loader
- archive/cf
- cache
- icon
- mathml
- page
- cocoa
- csp
- ios
- mac
- scrolling
- mac
- text-extraction
- win
- writing-tools
- platform
- cocoa
- graphics/win
- ios
- mac
- mediarecorder
- win
- plugins
- rendering
- cocoa
- mathml
- style
- svg
- legacy
- updating
- storage
- style
- svg
- animation
- graphics
- testing
- js
- workers
- service
- context
- worklets
- xml
- parser
- WebKitLegacy
- Storage
- WebCoreSupport
- ios/WebCoreSupport
- mac
- DOM
- WebCoreSupport
- WebView
- WebKit
- WebProcess
- Automation
- EncryptedMedia
- FullScreen
- InjectedBundle
- API/c
- DOM
- Inspector
- MediaStream
- Network
- webrtc
- Plugins
- PDF
- UnifiedPDF
- Storage
- WebCoreSupport
- gtk
- mac
- WebPage
- Cocoa
- CoordinatedGraphics
- glib
- ios
- mac
- cocoa
- Tools/TestWebKitAPI/Tests/WebCore
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1332 | 1332 | | |
1333 | 1333 | | |
1334 | 1334 | | |
| 1335 | + | |
1335 | 1336 | | |
1336 | 1337 | | |
1337 | 1338 | | |
1338 | 1339 | | |
1339 | 1340 | | |
1340 | 1341 | | |
1341 | 1342 | | |
| 1343 | + | |
| 1344 | + | |
1342 | 1345 | | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1343 | 1350 | | |
1344 | 1351 | | |
| 1352 | + | |
| 1353 | + | |
1345 | 1354 | | |
1346 | 1355 | | |
1347 | 1356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
0 commit comments