forum.vmspython.org Forum Index forum.vmspython.org
Forum system
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compileall Python program and executing it

 
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS
View previous topic :: View next topic  
Author Message
Vouters



Joined: 10 Jan 2011
Posts: 11

PostPosted: Mon Jan 10, 2011 7:51 pm    Post subject: compileall Python program and executing it Reply with quote

This has been tested under Python 2.7 on a Linux Fedora 14. This may perhaps interest some of you.
Here is where you can get all the needed information :
http://vouters.dyndns.org/tima/All-OS-Python-Compiling_a_Python_Program_and_Executing_the_compiled_version.html

Compiling a large Python program may help boosting the startup time but in no case helps improving its run-time performances.
Back to top
View user's profile Send private message
bisonmalembouche



Joined: 01 Jun 2005
Posts: 74

PostPosted: Tue Jan 11, 2011 3:09 pm    Post subject: Reply with quote

Philippe

Thanks for your post.

Do you have some numbers comparing the startup time and the run-time of some large Python programs ?

Gérard
Back to top
View user's profile Send private message Send e-mail
Vouters



Joined: 10 Jan 2011
Posts: 11

PostPosted: Wed Jan 12, 2011 3:07 pm    Post subject: Some performances with a SMALL Python program Reply with quote

Dear Gérard,

I have usually not written very large programs, but most often wrote small dedicated programs, either for my knowledge database or as a developers support person during my career.

However even with small programs, I can pinpoint performances bottlenecks, especially when I code the same algorythm using different languages. A typical example of this is this article http://vouters.dyndns.org/tima/Linux-Tcl-PHP-Perl-Python-Ruby-Java-C-C++-PCRE-Turning_Cobol_DECforms_C_VMS_Listings_to_source.html where this listing_to_source.py is available.

So that you do not confuse with the different performances figures given hereafter, the variation in performance depends upon the files (code and data) being disk cached in Linux memory or not. The best figures among those below are when the "Elapsed time" equals 105ms. The time Linux utility being prepended to the command gives you the overall figures from the start of the Python software to its exit C statement.

To conclude with these performances figures, the process to Python generate the bytecode takes so few time compared to the run-time execution that once disk cached, it makes no real performance improvement using [color=red]$python listing_to_source.py[/color] or [color=red]python listing_to_source.pyc[/color]

In the hope this answer your legimate question.
Philippe

[philippe@victor Python]$ time python listing_to_source.py ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 160ms.

real 0m0.254s
user 0m0.156s
sys 0m0.022s
[philippe@victor Python]$ time python listing_to_source.py ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 106ms.

real 0m0.175s
user 0m0.155s
sys 0m0.020s
[philippe@victor Python]$ time python listing_to_source.py ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 105ms.

real 0m0.172s
user 0m0.148s
sys 0m0.024s
[philippe@victor Python]$ time python listing_to_source.py ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 107ms.

real 0m0.174s
user 0m0.154s
sys 0m0.020s
[philippe@victor Python]$ time python listing_to_source.pyc ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 105ms.

real 0m0.194s
user 0m0.150s
sys 0m0.021s
[philippe@victor Python]$ time python listing_to_source.pyc ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 112ms.

real 0m0.177s
user 0m0.157s
sys 0m0.015s
[philippe@victor Python]$ time python listing_to_source.pyc ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 108ms.

real 0m0.175s
user 0m0.153s
sys 0m0.021s
[philippe@victor Python]$ time python listing_to_source.pyc ../../BSP-ALIGN/CLIPGMJO.LIS
Elapsed: 105ms.

real 0m0.171s
user 0m0.155s
sys 0m0.016s
[philippe@victor Python]$
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group