-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
After newest libgifski update the generator needs few seconds to start and the progress is laggy #95
Comments
I've made a branch with logging: https://github.com/sindresorhus/Gifski/tree/logging-for-95 I've wrapped the Here's the log output:
Notice how it takes 8 seconds from the last @kornelski Any ideas? |
I also noticed that most of the time when cancelling the conversion it will crash. |
What's the order of calls to the library? Are you setting the write callback before the frames? |
Yes: Line 88 in 90f8097
|
@issuehunt has funded $80.00 to this issue.
|
I spent some time and figured out the culprit. Seems like gifski lib goes to the writing block after we add 3 frames. The problem with this video is that adding these 3 frames takes a long time (2 seconds per each for me). Because of that there is 6 secs+ delay on this video. I extracted one of the frames and tried to create a gif with that frame using the rust lib and it was a lot quicker. Command I used: /gifski frame1.png frame1.png frame1.png -o gif.gif There might be a difference in how we use the lib, as we pass a data buffer vs I used a PNG image as a frame. Any suggestions @kornelski? Edit: I also tried to see if the in-memory-gif-generating is a problem, but getting similar results using the version with writing to file. |
Regarding the crashing, it seems to me that the variable |
@BowdusBrown the crash is already fixed in the #94 PR. The only thing right now is the delay in creating frames. I might try to go back to the old gifski version and see if it helps. Also, thanks for the findings from the instruments! |
The compression algorithm hasn't changed between versions, so the raw CPU requirements are identical. The only thing that has changed is that now the library spawns a thread internally, instead of expecting the app to use it from two threads. So I expect delays to come from mutexes/locking/threads waiting on each other. |
If you take a closer look at my screenshots above, you can see the icon representing code belonging to Gifski (the icon of a human head and shoulders) is shaded out in calls lower down. I believe those calls are inside the libgifski library and I'm curious to know why they appear shaded out in instruments. Anyone know? |
Edit: it seems like the old Gifski version was a lot quicker in progress and didn't need few second to starts. So not sure what went wrong when I was testing the previous lib version, but there is a big difference. |
So I was again researching the topic as few things didn't make sense to me. And it turns out that the problem was the optimization level. Basically when we compiled Gifski in Release scheme, everything was back to normal. It only behaved that way on Debug. |
There's still the problem that |
I can't reproduce that problem. |
In 6f6bf34 I've added another warning in case things were called out of order. |
I wouldn't be so sure... Happened when pressing cancel. I'm checked out at 6f6bf34 |
Ah yeah, I didn't update the comment, apologies. But after I wrote that comment, we still could get the crash on debug which is non-ideal... On release it seems to be working okayish. |
No worries. I have provided a fix #124 but really the root cause of why gifData is deallocated early is the real fix. It seems to be happening inside the static library. |
Closing as I don't think this is a problem anymore. The bounty here now applies to #180 instead. |
The bounty here now applies to #180 instead.
This is the video I reproduced it with.
new_gifski_transitions.mov.zip
IssueHunt Summary
Backers (Total: $80.00)
Become a backer now!
Or submit a pull request to get the deposits!
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor
The text was updated successfully, but these errors were encountered: