antonreshetov / image-optimizer

A tool for optimizing images and vector graphics.
MIT License
888 stars 63 forks source link

[Bug] Optimization of UI No Response #27

Open PublicWorld opened 1 year ago

PublicWorld commented 1 year ago

Describe the bug

Hi, when I try to upload a dozen photos in this macOS app, around 100 MB size, the compression process will cause the interface to keep loading and not be able to do anything, so do we have any optimization plan to solve this problem?

PublicWorld commented 1 year ago

@Christopher-Hayes Hi, I am glad to see that you are also involved in this project. Do you have any suggestions or solutions?

Christopher-Hayes commented 1 year ago

Hi @NumberCode I haven't been actively involved on this project for several months, so I can't offer any immediate fixes. I'll try to take a look at some point in December.

If you or anyone wants to try working on this - the first place I would take a look would be how file data is getting read into working memory and check if multiple files together are causing a memory spike that is freezing Electron. Optimization could involve making sure files are all gettings streamed (rather than put into working memory objects), checking for memory leaks / if any working memory file data is not getting garbage collected for some reason (Map vs WeakMap), or other ways to mitigate memory spikes.

Generally, the UI shouldn't freeze if we're doing the hard work on the Main thread and leaving the UI interactable on the Renderer thread. Freezing would usually mean the app hit some hardware limit like memory. But, there are probably improvements that could be made showing task progress, especially for lots of files / big files.

PublicWorld commented 1 year ago

Thank you so much for your response! It would be great if you were willing to take the time to solve this problem! I like this software very much, but I am not a professional front-end developer and don't know how to solve it. I tried searching the Internet and found that it seemed possible to use remote to create a hidden window to handle time-consuming tasks, how dou you think?

PublicWorld commented 1 year ago

🥹 No one handles this~