Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#61532 assigned defect (bug)

Improve the performance of `WP_Image_Editor_Imagick::supports_mime_type()`

Reported by: joemcgill's profile joemcgill Owned by: joemcgill's profile joemcgill
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch
Focuses: performance Cc:

Description

WP_Image_Editor_Imagick::supports_mime_type() is called whenever WordPress is choosing which image editor library to use via wp_image_editor_supports() > _wp_image_editor_choose().

To see if the current server's version of ImageMagick supports a specific mime type, that method calls Imagick::queryFormats(), which can take a long time to run.

In the editor, wp_plupload_default_settings() makes triggers this code path to see if modern formats like WebP and AVIF are supported, which leads to a slower editor load time.

Since these supports values rarely change except for when changing hosting environments, we can cache these supports values for faster lookups.

Change History (1)

This ticket was mentioned in PR #6936 on WordPress/wordpress-develop by @joemcgill.


3 weeks ago
#1

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.