humanmade / humanmade/altis-cloud
Imagick::queryFormats is slow, loaded on most admin pages
- Dominant language
- PHP
- Stars
- 9
- Forks
- 2
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 23
Description
`wp_plupload_default_settings()` calls:
```php
// Check if WebP images can be edited.
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$defaults['webp_upload_error'] = true;
}
// Check if AVIF images can be edited.
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) {
$defaults['avif_upload_error'] = true;
}
```
This in-turn does a `Imagick::queryFormats` per support, which is quite slow. E.g.
```bash
www-data@efddc66a02b9:/usr/src/app$ php -r '$start = microtime(true); var_dump( Imagick::queryFormats( "webp" ) ); var_dump( microtime( true ) - $start );'
array(0) {
}
float(0.0890190601348877)
```
This is pretty consistent. Given these is constant, I'm wondering if we could cache / hardcode this.
There doesn't appear to be any great hooks to be able to do that but might need more investigation.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.