Oct-09-2022, 06:56 PM
(Oct-09-2022, 03:54 PM)jpezz Wrote: I see a notable difference in my program speeds when using ram disks for program execution and for storing output informationIf your program does Input/Output, it will be faster if you read and write from RAM, but storing the program itself in RAM is not necessary, there is very little benefit. The program is always loaded to RAM when it is executed.
(Oct-09-2022, 03:54 PM)jpezz Wrote: Your example clearly shows the extra benefit of the pyc fileIt does not. If the program runs during more than a few seconds, the difference is neglectible. Try with real programs and show the performance measurements.
(Oct-09-2022, 03:54 PM)jpezz Wrote: #/usr/bin/python3The shebang line starts with #! , not # . It does not speed up anything.
(Oct-09-2022, 03:54 PM)jpezz Wrote: if the pyc file exists AND is newer AND I specify the py file, does python use the pycNo, as far as I know. Python uses automatically the .pyc file when modules are imported for the first time. I don't think it does this for the main program.
(Oct-09-2022, 03:54 PM)jpezz Wrote: My guess is also that the only purposes of the shebang is to tell the executing programThis guess is wrong. In Linux (and Unixes in general), if the file has a shebang and it is executable, the OS uses the shebang to know which program to call (here python3).
Again, apart from Input/Output in RAM, which can be really useful, all these «optimizations» seem futile to me.