[Tutor] how to calculate program compile time?
I'm doing puzzles where we need to write code that works as fast a possible So, how can I check the compile time of my program ?... ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] how to calculate program compile time?
On 2011/12/08 12:59 PM, surya k wrote: I'm doing puzzles where we need to write code that works as fast a possible So, how can I check the compile time of my program ?... ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor You can use the `timeit` [1] module or outside of Python if you're using Linux you can use `time`. That will give you your total execution time. You can also look at further performance tips [2] if needed. [1] http://docs.python.org/library/timeit.html [2] http://wiki.python.org/moin/PythonSpeed/PerformanceTips -- Christian Witts Python Developer // ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] how to calculate program compile time?
On 08/12/11 10:59, surya k wrote: I'm doing puzzles where we need to write code that works as fast a possible So, how can I check the compile time of my program ?... Why would that be helpful? The code is only compiled the first time you use it so any second run will use the compiled code for imported modules. Put your program in a module and then write a driver file that imports the main program... If you want to improve performance check the timings with the Python profiler. Tune the bits that need tuning. If thats still not enough look at rewriting the critical parts in Cython. Or if that fails use C. But that should be a last resort. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor