Created attachment 71671[details]
FEGaussianBlur with maximal size 4100x4100 (+ blur radius)
I checked the performance on this example. Replacing CanvasPixelArray* with WTF::ByteStream* increased the rendering time from 31s to 21s on my machine. Still slow but an increase of 30% (taking unsigned char*, like in bug 44528, didn't make a difference). Niko thought about fixing the style violation in platform/graphics/ImageBuffer::get/putImageData (RefPtr ImageData -> RefPtr CanvasPixelArray -> RefPtr ByteArray ) to increase the rendering speed as well. I agree him, but don't see that much performance win for now (less than < 2% of the time is spend in this functions + getting the ByteArray from ImageData).
I'd suggest to replace CanvasPixelArray* by WTF::ByteArray* on all filter effects + SVG masker in a first step. After that we spend the most time in calculating the position of all necessary pixels for the blurring process than in anything else. This needs further investigation on feGaussianBlur. Ariya was working on that for ContextShadow, maybe we can back-port his algorithm from ContextShadow to FEGaussianBlur (at least in parts) and look what happens.
The problem for lightning is of course CanvasPixelArray again, but also the normalization of the FloatPoint3D. Maybe Zoltan can take a look at this?

Comment on attachment 71675[details]
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=71675&action=review> WebCore/platform/graphics/filters/FEBlend.cpp:104
> - RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
> + RefPtr<WTF::ByteArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data()->data());
Discussed on IRC. This is the not right approach, CanvasPixelArray has to be stored in a RefPtr<> somewhere.
The performance increase that Dirk sees, is not calling canvasPixelArray->get(). It forward to call to the ByteArray, but CanvasPixelArray stores a RefPtr<ByteArray>. The slowness is because of calling operator-> on the RefPtr.
The best way to fix this now, is to leave RefPtr<CanvasPixelArray> as is, and store "ByteArray* srcByteArrayA = srcPixelArrayA->data()" in a local variable. That gives the same benefit.

Comment on attachment 71679[details]
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=71679&action=review> WebCore/platform/graphics/filters/FEBlend.cpp:38
>
> +using WTF::ByteArray;
This is wrong, it belongs on the bottom of wtf/ByteArray.h.
> WebCore/platform/graphics/filters/FEBlend.cpp:108
> + RefPtr<CanvasPixelArray> srcCanvasPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
> + ByteArray* srcPixelArrayA(srcCanvasPixelArrayA->data());
This is dangerous.
RefPtr<ImageData> srcImageDataA = in->resultImage()->getPremultipliedImageData(effectADrawingRect);
ByteArray* srcPixelArrayA(srcImageDataA->data()->data());
That would be a safe pattern. The ImageData is refcounted, it's contained CanvasPixelArray too, and it's contained ByteArray as well.
You only need to hold the ImageData in a RefPtr, then you can safely access the ByteArray pointer.
This affects multiple places, please look through them first.