There are a few bugs which have impacted APNG performance in the last few years. * < Firefox 62 - Decodes APNGs once, higher memory footprint. * Firefox 62 - Bug 1460258 discards and redecodes frames as necessary for large APNGs (if total number of frames exceed 20MB by default). This should have improved the APNG decode/blend speed as well although it would do it more often. * Firefox 65 - Bug 1465619 makes us reuse memory buffers, avoid the allocation/free cost, as well as reuse the contents of the buffer. * Firefox 71 - Bug 1551088 should reduce PNG decode times (6-7% on average according to telemetry) by improving RGB expansion to RGBA (if opaque) and alpha premultiplication (if transparent). Here we have a 640x640 sized image, which has a 1.56MB footprint per frame. From the profile traces it is clear that we exceed the memory threshold and opt to redecode. As far as I understand it, Chrome makes the same decision, and ought to redecode as well. You can try changing image.animated.decode-on-demand.threshold-kb to be much larger to not discard/redecode the APNG and see what impact that has on performance. I wasn't able to reproduce similar performance on an Intel Core i7-4900MQ.
Bug 1592364 Comment 15 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
There are a few bugs which have impacted APNG performance in the last few years. * < Firefox 62 - Decodes APNGs once, higher memory footprint. * Firefox 62 - Bug 1460258 discards and redecodes frames as necessary for large APNGs (if total number of frames exceed 20MB by default). This should have improved the APNG decode/blend speed as well although it would do it more often. * Firefox 65 - Bug 1465619 makes us reuse memory buffers, avoid the allocation/free cost, as well as reuse the contents of the buffer. * Firefox 69 - Bug 1255106 had some color management changes that should not have had a major impact on APNGs, but maybe is relevant given the timeline. * Firefox 71 - Bug 1551088 should reduce PNG decode times (6-7% on average according to telemetry) by improving RGB expansion to RGBA (if opaque) and alpha premultiplication (if transparent). Here we have a 640x640 sized image, which has a 1.56MB footprint per frame. From the profile traces it is clear that we exceed the memory threshold and opt to redecode. As far as I understand it, Chrome makes the same decision, and ought to redecode as well. You can try changing image.animated.decode-on-demand.threshold-kb to be much larger to not discard/redecode the APNG and see what impact that has on performance. I wasn't able to reproduce similar performance on an Intel Core i7-4900MQ.