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

.appimage is slow to start — include .pyc into the bundle #9184

Open
ValdikSS opened this issue Sep 5, 2024 · 3 comments
Open

.appimage is slow to start — include .pyc into the bundle #9184

ValdikSS opened this issue Sep 5, 2024 · 3 comments
Labels
build/packaging 📦 OS-linux 🐧 probably-easy 🍰 pull-request wanted 📣 Help would be much appreciated if you have expertise and time.

Comments

@ValdikSS
Copy link
Contributor

ValdikSS commented Sep 5, 2024

AppImage (Linux) version of electrum is rather slow to start, it takes about 3 seconds on my modern Intel 1340P machine.
This is because Python bytecode (.pyc files) are not included into .appimage, and since appimage could not be updated, Python compiles them every run.

If .appimage is exctracted with ./electrum-4.5.5-x86_64.AppImage --appimage-extract and ran from the directory (so it could update itself), subsequent runs are vastly faster.

$ time ./electrum-4.5.5-x86_64.AppImage daemon --help
…
real    0m1,597s
user    0m1,201s
sys     0m0,075s

$ time ./electrum-4.5.5-x86_64.AppImage daemon --help
…
real    0m0,640s
user    0m0,380s
sys     0m0,052s

Please run the application once in your building process, and include all the built .pyc files into .appimage.`

@ValdikSS
Copy link
Contributor Author

ValdikSS commented Sep 5, 2024

The other appimage-related optimization is to use zstd compression.
Current "stable" version of AppImageKit does not support it, so new appimagetool should be used
https://github.com/AppImage/appimagetool/

@SomberNight
Copy link
Member

Sounds like it might be worth trying including the .pyc files indeed. In fact in the android apk I think we are only including the .pyc files for the same (startup speed) reasons.

Hopefully there is a nicer approach than actually "running" the application. There should be, as we are not doing that for Android.

@ValdikSS
Copy link
Contributor Author

ValdikSS commented Sep 6, 2024

Yes, seems there's compileall module.
python -m compileall ., something like that.

@SomberNight SomberNight added probably-easy 🍰 pull-request wanted 📣 Help would be much appreciated if you have expertise and time. labels Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/packaging 📦 OS-linux 🐧 probably-easy 🍰 pull-request wanted 📣 Help would be much appreciated if you have expertise and time.
Projects
None yet
Development

No branches or pull requests

2 participants