<?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>191197</bug_id>
          
          <creation_ts>2018-11-02 10:23:53 -0700</creation_ts>
          <short_desc>SVG filters crash on iOS and are slow in general</short_desc>
          <delta_ts>2022-02-16 05:27:54 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>Safari 12</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jan Bösenberg">jan.boesenberg</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>tomac</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>xidorn-webkit</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1474545</commentid>
    <comment_count>0</comment_count>
      <attachid>353709</attachid>
    <who name="Jan Bösenberg">jan.boesenberg</who>
    <bug_when>2018-11-02 10:23:53 -0700</bug_when>
    <thetext>Created attachment 353709
Test case for filter performance

A simple SVG using filters may crash on Safari iOS and is very slow.

To reproduce the issue open the attached test case or follow this link:   https://codepen.io/anon/pen/eQOxKE

With each cycle the test adds a clone of an SVG to the document. The SVG consists of a rect which has a filter applied.

It crashes after ~10 cycles on iPhone 4s, ~35 cycles on iPhone X and ~80 cycles on iPhone SE. On Safari desktop it is easily five times slower than Chrome, maybe comparable to Internet Explorer 11.

More notes:
- The same problem occurs if one SVG is created with multiple filtered rect elements, even if the same filter is applied to all elements.
- It does not matter what the filter does, even an empty filter containing only &lt;feOffset /&gt; gives the same result.
- I could not reproduce the crash with masks, so there seems to be a difference (although better performance on masks would not hurt)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474828</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-11-03 16:38:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/45787332&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474861</commentid>
    <comment_count>2</comment_count>
    <who name="Jan Bösenberg">jan.boesenberg</who>
    <bug_when>2018-11-04 02:27:20 -0800</bug_when>
    <thetext>For filters on monochrome rectangles (like in the example) where all pixels are manipulated the same (feColorMatrix, feComponentTransfer, etc), setting filterRes=&quot;1&quot; will speed up things dramatically (by a factor 20 or so) and prevent the crashing.

Here is a modified version with filterRes set to 1:
https://codepen.io/anon/pen/LXYKJK

Unfortunately filterRes is obsolete in SVG2 and will be removed in the next Safari version (see bug 129565), so there will be no solution left. It&apos;s probably futile but I would suggest to keep support for filterRes in Safari until the performance issues with SVG filters are solved.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>353709</attachid>
            <date>2018-11-02 10:23:53 -0700</date>
            <delta_ts>2018-11-02 10:23:53 -0700</delta_ts>
            <desc>Test case for filter performance</desc>
            <filename>filter-crash-test.html</filename>
            <type>text/html</type>
            <size>1540</size>
            <attacher name="Jan Bösenberg">jan.boesenberg</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8aGVhZD4NCiAgPHRpdGxlPlNWRyBGaWx0ZXIgUGVyZm9ybWFuY2UgYW5kIENyYXNo
IFRlc3Q8L3RpdGxlPg0KPC9oZWFkPg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