Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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.mapper
service rather than here?See also comment #39 in that issue.
Comment #5
yched CreditAttribution: yched commented@mondrake: indeed, would be a much nicer cleanup.
Closing as a dupe then.