NEW 191197
SVG filters crash on iOS and are slow in general
https://bugs.webkit.org/show_bug.cgi?id=191197
Summary SVG filters crash on iOS and are slow in general
Jan Bösenberg
Reported 2018-11-02 10:23:53 PDT
Created attachment 353709 [details] 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 <feOffset /> 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)
Attachments
Test case for filter performance (1.50 KB, text/html)
2018-11-02 10:23 PDT, Jan Bösenberg
no flags
Radar WebKit Bug Importer
Comment 1 2018-11-03 16:38:13 PDT
Jan Bösenberg
Comment 2 2018-11-04 02:27:20 PST
For filters on monochrome rectangles (like in the example) where all pixels are manipulated the same (feColorMatrix, feComponentTransfer, etc), setting filterRes="1" 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's probably futile but I would suggest to keep support for filterRes in Safari until the performance issues with SVG filters are solved.
Note You need to log in before you can comment on or make changes to this bug.