Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8671f597bd6cd2f183824a7220153af10f9d5cd8
      
https://github.com/WebKit/WebKit/commit/8671f597bd6cd2f183824a7220153af10f9d5cd8
  Author: Brent Fulgham <[email protected]>
  Date:   2026-05-22 (Fri, 22 May 2026)

  Changed paths:
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    A Source/JavaScriptCore/Scripts/generate-header-postprocess-config.sh
    M Source/JavaScriptCore/Scripts/postprocess-header-rule
    A Source/WebKit/Scripts/generate-header-postprocess-config.sh
    M Source/WebKit/Scripts/postprocess-header-rule
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Reduce cost of framework-headers rule invocations
https://bugs.webkit.org/show_bug.cgi?id=315311
rdar://177643527

Reviewed by Geoffrey Garen.

My earlier change to ENABLE_USER_SCRIPT_SANDBOXING=YES (Bug 313032) wrapped
every PBXBuildRule invocation in sandbox-exec. JavaScriptCore and WebKit each
have a "headers" PBXBuildRule that runs `postprocess-header-rule`, which
sources (when present) the WebKitAdditions 
`postprocess-framework-headers-definitions`
file on every header. Per invocation the perl + JSON parse cost is small, but
multiplied across ~1500 header (for a clean build) it is significant.

Instead, we should compute the version constants once per build in a new
producer phase hosted on the framework's Derived Sources aggregate target. The
producer sources the WebKitAdditions definitions (when present) and writes a
shell-sourceable config file to SHARED_DERIVED_FILE_DIR.

This cache is regenerated automatically when its declared inputs change (e.g., 
the
WebKitAdditions definitions, branch_config.json, or the script itself). SDK and
toolchain changes invalidate the cache through Xcode's standard dependency 
tracking,
as it does for all other build steps.

This change also modifies the framework targets to wait on the cache producer
so that the *.h rule scheduler does not dispatch header tasks before the cache 
file
is created.

Measured on a clean release build (5 iterations):
- JavaScriptCore: -44s of header-rule CPU
- WebKit: -13s of header-rule CPU
- Net: -52s on classified targets, ~-34s wall

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Added
  the producer phase to the Derived Sources aggregate target, declared the 
cache file
  as an inputFile of the *.h PBXBuildRule, and added an explicit 
PBXTargetDependency
  from the JavaScriptCore framework target to the aggregate.
* Source/JavaScriptCore/Scripts/generate-header-postprocess-config.sh: Added.
* Source/JavaScriptCore/Scripts/postprocess-header-rule: Source the per-build 
cache
  file if present; fall back to the legacy per-invocation source on miss.
* Source/WebKit/Scripts/generate-header-postprocess-config.sh: Added.
* Source/WebKit/Scripts/postprocess-header-rule: Same caching path as the
  JavaScriptCore version, keyed off a WebKit-named cache file.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj: Similar changes as 
JavaScriptCore.

Canonical link: https://commits.webkit.org/313764@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to