Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagick driver works super slow with v11 #3583

Open
aprokopenko opened this issue Apr 15, 2024 · 3 comments
Open

Imagick driver works super slow with v11 #3583

aprokopenko opened this issue Apr 15, 2024 · 3 comments

Comments

@aprokopenko
Copy link
Contributor

Hi,

we just upgraded to v11 from v10. All working fine except conversions and image manipulations are working super slow (2 mins comparing to 1 second) with "imagick" driver.

We use PHP 8.2.15, imagick 3.7.0 (installed via pecl).
Changing driver to gd provides better results, but still about 6-7 seconds, not 1 sec as before.
We have feature tests, and now all tests with image manipulations processed about 130-150secs instead of 5-6secs.

I'm not sure how to reproduce the bug, here are our settings:

$this
    ->addMediaCollection('hero')
    ->useDisk($publicDisk)
    ->singleFile()
    ->registerMediaConversions(function (Media $media) {
        $this->addMediaConversion('backoffice')
            ->fit(...config('media-library.defaults_conversions.backoffice'))
            ->nonQueued();

        $this
            ->addMediaConversion('thumb')
            ->fit(...config('media-library.defaults_conversions.thumb'));

        $this
            ->addMediaConversion('hd')
            ->withResponsiveImages()
            ->fit(...config('media-library.defaults_conversions.hd'));

        $this->addMediaConversion('thumb_sm')
            ->fit(...config('media-library.offerings_conversions.thumb_sm'));
        $this->addMediaConversion('thumb_lg')
            ->fit(...config('media-library.offerings_conversions.thumb_lg'));
    });

and the configs:

    'defaults_conversions' => [
        'backoffice' => [Fit::Crop, 100, 50],
        'thumb' => [Fit::Crop, 720, 420],
        'hd' => [Fit::Crop, 1920, 1080],
    ],

    'offerings_conversions' => [
        'thumb_sm' => [Fit::Crop, 431, 307],
        'thumb_lg' => [Fit::Crop, 720, 775],
    ],
@aprokopenko
Copy link
Contributor Author

We re-tested our API and found that it works fine, so the problem appears only when running feature tests. As a hotfix we set gd for tests for now, but it's very weird behavior. With v10 there are no such problems on any driver.

@patinthehat
Copy link
Collaborator

@aprokopenko Just to clarify, you mean when running your feature tests, not the feature tests included with this package? Thanks for following up on the issue as well! 👍

@timvandijck
Copy link
Member

We re-tested our API and found that it works fine, so the problem appears only when running feature tests. As a hotfix we set gd for tests for now, but it's very weird behavior. With v10 there are no such problems on any driver.

That's intresting. V11 has the updated spatie/image package under the hood where we replaced intervention/image with our own code. I would have expected that most of the "heaviness" comes from Imagick itself though, so I'm curious to what we do differently than intervention/image to cause a difference.

If anyone has ideas I would be happy to read them and optimize our package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants