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

decoder.decode runtime problem since version 4.1.4 #635

Open
Mike-3 opened this issue Apr 4, 2024 · 3 comments
Open

decoder.decode runtime problem since version 4.1.4 #635

Mike-3 opened this issue Apr 4, 2024 · 3 comments

Comments

@Mike-3
Copy link

Mike-3 commented Apr 4, 2024

We have found that decode animated gifs with version 4.1.4 takes approx. 50 times longer than with version 4.1.3.
In version 4.1.7 it is still like this.

Here are my recorded times for different versions, for the example gif.

4.1.2 approx 1s
4.1.3 approx 1s
4.1.4 approx 56s
4.1.7 approx 56s

Example gif:
http://up.picr.de/18592631jk.gif

Source code

  final decoder = Image.findDecoderForData(bytes);

    if (decoder == null) return null;
var startTime = DateTime.now();
    var animation = <Image.Image>[];
    var image = decoder.decode(bytes);
print(DateTime.now().difference(s).inMilliseconds.toString());
@brendan-duncan
Copy link
Owner

Thanks for reporting this, I'll get it sorted out as soon as I can.

@brendan-duncan
Copy link
Owner

The palette remapping code that was added to handle GIFs per-frame palettes is terribly slow currently, so I disabled it for now. The example gif you provided still parses correctly, but GIF is a weird format so some edge case gifs might have a problem without the remapping. I'll have to find a faster way to do that.

@brendan-duncan
Copy link
Owner

The version in git should be a lot faster than it was. It will still have some overhead over the 4.1.3 version, but the 4.1.3 version had a lot of issue with animated gifs.

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

No branches or pull requests

2 participants