I was curious about why blur filters on image backgrounds are incredibly slow. Sampling shows lots of time in GenericTypedArrayView::set(unsigned index, double value) const which is doing a safe double -> int cast with clamping. This comes out of a tight look in the blurring code: for (int x = 0; x < effectWidth; ++x) { int pixelByteOffset = line + x * stride + channel; dstPixelArray->set(pixelByteOffset, static_cast<unsigned char>(sum / dx)); It's crazy that we're wasting time doing double -> int conversion when the caller is passing in an unsigned char. We're converting double -> unsigned char -> double -> int32_t -> uint8_t Bypassing this crap by just filling a uint8_t[] and using dstPixelArray->setRange() makes blurring twice as fast.
Created attachment 210684 [details] Testcase
<rdar://problem/14930799>
Started looking into this.
It is still taking several steps to blur completely in Safari 16.2 & STP160 but this does not seem to be working in Chrome Canary 111 and Firefox Nightly 110 for some reasons even after modifying to change pic URL to HTTPS and removing -webkit- prefix in following: URL - https://jsfiddle.net/unz3h758/2/show