responsive_image_build_source_attributes() calls Drupal::service('file.mime_type.guesser.extension')->guess() over and over for all images in an srcset, while the actual file extensions will most likely be the same.
Maybe the _responsive_image_image_style_url() should do some sort of static caching ?
Comments
Comment #1
attiks commentedExtension can be different for each derivative but static caching for each combo of source and image style might be a speed improvement.
Comment #2
yched commentedwell, we still need to call the image style to give us the resulting extension, but we can statically cache the [extension => mime type] resolution ?
Comment #3
attiks commentedTrue
Comment #4
mondrakeWouldn't it be better to get this #2311679: Separate MIME type mapping from ExtensionMimeTypeGuesser in first, and then (if needed) do the static caching in the new
file.mime_type.mapperservice rather than here?See also comment #39 in that issue.
Comment #5
yched commented@mondrake: indeed, would be a much nicer cleanup.
Closing as a dupe then.