Go Back   maemo.org - Talk > OS / Platform > Maemo 5 / Fremantle
 
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
  #1  
Old 2010-04-22, 10:56
lcuk's Avatar
lcuk lcuk is offline
 
Join Date: Apr 2008
Location: Manchester, England
Posts: 1,635
Thanks!: 1,486
Thanked 1,816 Times in 642 Posts
Default Making Python faster (for fmms initially)

Hi,
looking for suggestions/ideas/code/methods for making python faster!

in #maemo irc, x-fade remembered about a pylauncher project, but does not know of its active status in fremantle:
http://pylauncher.garage.maemo.org/

what other things can we do to effectively speed up python
simple things, suggestions metrics etc
does removing the comments make a noticable difference to script runtime?
mini ad-hoc brainstorming session..


================================================== ====
Update, added wiki page results

A couple of weeks later and after much discussion and testing we have a fairly decent set of guidelines and best practices \o/

Performance_Considerations_for_Python_Apps


thanks to epage for the excellent wiki writeup
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk

Last edited by lcuk; 2010-05-20 at 14:20.
Reply With Quote
The Following 11 Users Say Thank You to lcuk For This Useful Post:
  #2  
Old 2010-04-22, 11:04
Bundyo's Avatar
Bundyo Bundyo is offline
 
Join Date: Oct 2007
Location: Bulgaria
Posts: 4,708
Thanks!: 7,443
Thanked 4,649 Times in 1,717 Posts
Default Re: Making Python faster (for fmms initially)

Is this possible on ARM:

http://psyco.sourceforge.net/
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.
Reply With Quote
The Following 3 Users Say Thank You to Bundyo For This Useful Post:
  #3  
Old 2010-04-22, 11:06
un-named_user un-named_user is offline
 
Join Date: Nov 2009
Location: T.M.O
Posts: 77
Thanks!: 114
Thanked 160 Times in 43 Posts
Default Re: Making Python faster (for fmms initially)

I'm not a developer so not 100% sure, but this thread is somewhat similar/hopefully helpful.

http://talk.maemo.org/showthread.php?t=47850

Edit: just noticed that the other thread is only for improving the inital startup times and not in general. My bad

Last edited by un-named_user; 2010-04-22 at 11:13.
Reply With Quote
The Following 3 Users Say Thank You to un-named_user For This Useful Post:
  #4  
Old 2010-04-22, 11:11
lcuk's Avatar
lcuk lcuk is offline
 
Join Date: Apr 2008
Location: Manchester, England
Posts: 1,635
Thanks!: 1,486
Thanked 1,816 Times in 642 Posts
Default Re: Making Python faster (for fmms initially)

Quote:
Originally Posted by un-named_user View Post
I'm not a developer so not 100% sure, but this thread is somewhat similar/hopefully helpful.

http://talk.maemo.org/showthread.php?t=47850

Edit: just noticed that the other thread is only for improving the inital startup times and not in general. My bad.
don't apologise - its all part of the same thing!
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk
Reply With Quote
The Following User Says Thank You to lcuk For This Useful Post:
  #5  
Old 2010-04-22, 11:20
noobmonkey's Avatar
noobmonkey noobmonkey is offline
 
Join Date: Nov 2009
Location: Worthing, England
Posts: 3,203
Thanks!: 2,570
Thanked 1,391 Times in 734 Posts
Default Re: Making Python faster (for fmms initially)

Interesting post....... I feel i may be able to provide a few tests to back up issues....

Healthcheck currently has about 300 redundant lines of code (Comments + Blank lines) probably 25% of the total.

I'll run a version of it without all of those and compare load times
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
Reply With Quote
The Following 4 Users Say Thank You to noobmonkey For This Useful Post:
  #6  
Old 2010-04-22, 11:25
un-named_user un-named_user is offline
 
Join Date: Nov 2009
Location: T.M.O
Posts: 77
Thanks!: 114
Thanked 160 Times in 43 Posts
Default Re: Making Python faster (for fmms initially)

@lcuk
My damn N900 ate the smiley for some reason & made me look like a sad panda

Anyways good to see the overall scheme includes start up improvements too.
Reply With Quote
  #7  
Old 2010-04-22, 11:25
mikec's Avatar
mikec mikec is offline
 
Join Date: Jan 2006
Posts: 1,366
Thanks!: 1,373
Thanked 1,185 Times in 410 Posts
Default Re: Making Python faster (for fmms initially)

The import method of not importing everything has some postive impacts, though probably small.

- reduce startup time
- reduces code size as your code no longer has to refer to the base class. ie qtcore.qrectangle becomes just qrectangle
- not sure if references become a bit faster internally, but feels right to me.

I would also use constants where possible rather than have them values recalculated, as is often the case in code.

given most heavy lifting code is done inside the libraries like qt I,m not sure python is much slower, and if you ae not using libraries why not especially given the richness of them. of course YMMV
__________________
N900_Email_Options Wiki Page
Reply With Quote
The Following 4 Users Say Thank You to mikec For This Useful Post:
  #8  
Old 2010-04-22, 11:33
lcuk's Avatar
lcuk lcuk is offline
 
Join Date: Apr 2008
Location: Manchester, England
Posts: 1,635
Thanks!: 1,486
Thanked 1,816 Times in 642 Posts
Default Re: Making Python faster (for fmms initially)

from irc:
Quote:
<frals> right fixed the gtk import now anyway so the daemon doesnt import it, not sure about startup time but its taking 13MB less in memory :P
that sounds like an improvement right off the bat!
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk
Reply With Quote
The Following User Says Thank You to lcuk For This Useful Post:
  #9  
Old 2010-04-22, 11:33
johnel johnel is offline
 
Join Date: Dec 2009
Location: earth?
Posts: 999
Thanks!: 1,251
Thanked 1,117 Times in 394 Posts
Default Re: Making Python faster (for fmms initially)

When we talk about making Python "faster" do we mean:
(a) perceptionally faster (e.g. time to reach first screen)
(b) execution speed
__________________
I like cake.
Reply With Quote
  #10  
Old 2010-04-22, 11:34
attila77 attila77 is offline
 
Join Date: Aug 2008
Location: Finland
Posts: 3,319
Thanks!: 2,884
Thanked 5,610 Times in 1,751 Posts
Default Re: Making Python faster (for fmms initially)

Quote:
Originally Posted by Bundyo View Post
Is this possible on ARM:

http://psyco.sourceforge.net/
The concept, yes, but isn't really popular on ARM as it uses quite a bit of memory, which is often not in abundance in the embedded world. There were pioneering attempts on ARM (not the 'real' psyco, that one is i386+ only), but I have no idea what phase did they get to.

Also, for tricks using preloaders: Please consider what that does to memory - keeping GTK and/or QT bindings in there is quite a burden, think it through before you commit to such a thing.
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
Reply With Quote
The Following 2 Users Say Thank You to attila77 For This Useful Post:
Reply

Tags
performance, python


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 19:48.