<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>311831</bug_id>
          
          <creation_ts>2026-04-09 10:19:00 -0700</creation_ts>
          <short_desc>Build time improvement: Use extern template instantiation for high-traffic mpark::variant instantiations</short_desc>
          <delta_ts>2026-04-17 15:15:48 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brent Fulgham">bfulgham</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2198414</commentid>
    <comment_count>0</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-04-09 10:19:00 -0700</bug_when>
    <thetext>Reduce redundant template instantiation across translation units by adding explicit template instantiation for commonly used mpark::variant types in widely-included WebCore headers.

This reduces compile time by avoiding the repeated template expansions (which have to be culled at link time). Currently every translation unit does a template expansion of the variant machinery, which has to be removed at a later build step. Both operations add time to the build.

On my system, this current patch reduced build time by 5.4%.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2198415</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-04-09 10:19:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/174419851&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2198422</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-04-09 10:29:58 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/62367</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2198543</commentid>
    <comment_count>4</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-04-09 15:55:13 -0700</bug_when>
    <thetext>Results from my M4 MBP:

```
====================================================================================================
AGGREGATE CATEGORY COMPARISON (matched TUs only)
====================================================================================================
  Frontend                                12256.4s -&gt;    12232.8s  (-23.6s, -0.2%)
  Backend                                  4271.6s -&gt;     4273.3s  (+1.7s, +0.0%)
  ParseClass                               4611.2s -&gt;     4537.8s  (-73.4s, -1.6%)
  InstantiateFunction                     12829.7s -&gt;    12745.9s  (-83.7s, -0.7%)
  InstantiateClass                         5116.3s -&gt;     5150.7s  (+34.4s, +0.7%)
  PerformPendingInstantiations             2382.6s -&gt;     2315.5s  (-67.1s, -2.8%)
  CodeGen Function                          516.6s -&gt;      537.4s  (+20.8s, +4.0%)
  OptFunction                              1413.2s -&gt;     1426.0s  (+12.8s, +0.9%)
  OptModule                                2554.0s -&gt;     2532.5s  (-21.5s, -0.8%)

====================================================================================================
FINAL SUMMARY  —  build IMPROVED by 18.0s (0.8%)
====================================================================================================
  Total compile time:                     16674.0s -&gt;    16655.9s  (-18.0s, -0.8%)

  Frontend                                -23.6s  (-0.2%)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  Backend                                  +1.7s  (+0.0%)  &gt;&gt;
  ParseClass                              -73.4s  (-1.6%)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  InstantiateFunction                     -83.7s  (-0.7%)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  InstantiateClass                        +34.4s  (+0.7%)  &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
  PerformPendingInstantiations            -67.1s  (-2.8%)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  CodeGen Function                        +20.8s  (+4.0%)  &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
  OptFunction                             +12.8s  (+0.9%)  &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
  OptModule                               -21.5s  (-0.8%)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;

  Template instantiations (net):       -49.3s
    time saved:                        -1266.0s  (templates faster or removed)
    time added:                        +1216.7s  (templates slower or new)

```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2198544</commentid>
    <comment_count>5</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-04-09 15:55:32 -0700</bug_when>
    <thetext>Note: The 5.4% was for a different patch. This small change only nets 0.8%.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2201673</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-17 15:15:46 -0700</bug_when>
    <thetext>Committed 311479@main (c69a763f29d8): &lt;https://commits.webkit.org/311479@main&gt;

Reviewed commits have been landed. Closing PR #62367 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>