<?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>100814</bug_id>
          
          <creation_ts>2012-10-30 22:19:26 -0700</creation_ts>
          <short_desc>Region::union on a list of does N^2 copies of Shape vectors</short_desc>
          <delta_ts>2013-09-04 10:37:01 -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>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>98800</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Seidel (no email)">eric</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>leviw</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>754965</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2012-10-30 22:19:26 -0700</bug_when>
    <thetext>Region::union on a list of does N^2 copies of Shape vectors

Regions are mutable, but their Shapes are not.  Each Shape has 2 vectors which are both copied into a new Shape object when two Shapes are combined.

To union a list of Regions into a single Region amounts to copying the contents of the first region&apos;s Shape vectors N times!  (The second region&apos;s shape vectors N-1, times, etc.)

The sum of a list from 1 to N is N(N-1)/2, which is for our purposes is order N^2. :(

Prior to my mitigation in bug 98800, we performed this O(N^2) algorithm every time we did RenderLayerCompositor::computeCompositingRequirements (which is currently on every style recalc!)

This could be solved by making a mutable union which built up a Shape, instead of copying each pair into a new Shape.

I&apos;ve split this off from bug 98800 so we can land a mitigation for RoboHornet now, and fix the algorithm complexity of Region/Shape combining later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>755044</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2012-10-31 01:23:02 -0700</bug_when>
    <thetext>(In reply to comment #0)
&gt; Prior to my mitigation in bug 98800, we performed this O(N^2) algorithm every time we did RenderLayerCompositor::computeCompositingRequirements (which is currently on every style recalc!)

This every-style-recalc behavior is tracked by bug 84393.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>