How to speed up first launch of a --onedir executable? #8970
-
My project (~400 MB) imports several dynamic libraries. I am building for macOS. I have built the executable via --onedir, as this makes the startup time much faster, compared to the --onefile option. This difference has been mentioned often in previous discussions. However, I find that the first launch of a --onedir executables still takes around the same amount of time as that of a --onefile executable. Subsequent launches of the --onedir executable, however, are very fast, and nearly the same speed as just running my original .py script. Could those that are more knowledgable about pyinstaller share some details on why the first launch of a --onedir executable is so much slower? Is there any way to perform whatever slow operations are occurring ahead of time, so that a user that installs my app does not have to sit through the first initial slow launch? If that is not possible, can anyone share advice on how to go about profiling which steps occurring in the first launch of the --onedir executable are slow? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What OS are we talking about here? If it's Windows or macOS, then the very first launch might be slowed down by anti-virus program scanning your program and its libraries? |
Beta Was this translation helpful? Give feedback.
Then your application is likely undergoing scan by the OS on the first run. Having it properly signed/notarized might help with that.