Python/Harmattan/Performance Considerations for Python Apps
(Starting a page to collect performance considerations) |
m (Fixing some bad wiki markup) |
||
Line 20: | Line 20: | ||
=== Unladen Swallow === | === Unladen Swallow === | ||
- | [http://www.python.org/dev/peps/pep-3146/ | + | [http://www.python.org/dev/peps/pep-3146/ PEP 3146 - Merging of Unladen Swallow] |
Currently Unladen Swallow has not seen too much performance benefit but has a longer start up time and takes more memory | Currently Unladen Swallow has not seen too much performance benefit but has a longer start up time and takes more memory | ||
Line 36: | Line 36: | ||
=== /usr/bin/python Startup === | === /usr/bin/python Startup === | ||
- | [http://pylauncher.garage.maemo.org/ | + | [http://pylauncher.garage.maemo.org/ PyLauncher] was favored back in the Maemo 4.1 days but has fallen out of favor lately. |
=== Parsing .py files === | === Parsing .py files === | ||
Line 42: | Line 42: | ||
=== Perceived Startup Performance === | === Perceived Startup Performance === | ||
- | [http://lists.maemo.org/pipermail/maemo-developers/2009-October/021478.html | + | [http://lists.maemo.org/pipermail/maemo-developers/2009-October/021478.html hildon_gtk_window_take_screenshot] takes advantage of user perception to make the user think the app is launched faster. |
== Responsiveness == | == Responsiveness == |
Revision as of 12:20, 20 May 2010
Based on Python faster (for fmms initially) and Qt startup time tips
Contents |
Profiling
Do not worry about performance unless you notice a problem. Then only optimize what you can justify with profiling.
To profile Python code, run it with
$ python -m cProfile -o .profile TOPLEVEL_SCRIPT.py
To then analyze the results
$ python -m pstats .profile > sort cumulative > stats 40
That sorted the results by the time it took for a function and all the functions it called. It then displays the top 40 results.
Improving Performance
Interpreter Choice
Unladen Swallow
PEP 3146 - Merging of Unladen Swallow
Currently Unladen Swallow has not seen too much performance benefit but has a longer start up time and takes more memory
Psyco / Cython
Do these work with Arm?
Shedskin
C with CTypes
Startup
/usr/bin/python Startup
PyLauncher was favored back in the Maemo 4.1 days but has fallen out of favor lately.
Parsing .py files
Perceived Startup Performance
hildon_gtk_window_take_screenshot takes advantage of user perception to make the user think the app is launched faster.
Responsiveness
Memory Usage
FAQ
Is Python slow?
The standard response of "it depends". For a graphical application not doing too much processing a user will probably not notice it is written in Python. Compare that to an experiment by epage in writing a GST video filter in python that at best ran at 2 seconds per frame.