maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Making Python faster (for fmms initially) (https://talk.maemo.org/showthread.php?t=50737)

lostinmirkwood 2010-04-29 18:43

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by Khertan (Post 629969)
In case also you are interested ... i ve also write a piece of code to trap every untraped exception to be able to display dialog to user asking him if it want to report it to my bugtracker.

khertan, I'm quite interested in looking at that snippet if you wouldn't mind sharing.

mikkov 2010-04-29 23:52

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by attila77 (Post 627924)
An alternative for handling this ^ is in the postinst/postrm script on the device, that way the debs are kept smaller and apt needs to track less files (at the cost of doing that yourself and a longer install time). Plus, should a system update be shipped with a pyc incompatible Python version, reinstalling the packages updates the pyc/pyo-s without any maintainer intervention.

Isn't python-support and python-central exactly for this? Python-support is even very easy to use, basically just add dh_pysupport to debian/rules and python-support to build-depends and depends. Just make sure that postinst has #DEBHELPER# somewhere

attila77 2010-04-30 07:30

Re: Making Python faster (for fmms initially)
 
what he says ^, no idea how I could have forgotten about dh_pysupport

mbo 2010-04-30 14:11

Re: Making Python faster (for fmms initially)
 
i've managed to build my app with dh_pysupport and it seems to load faster now.

.pyc files were build. Is there a significant difference to .pyo files?

chemist 2010-04-30 14:17

Re: Making Python faster (for fmms initially)
 
Afaik you should not hack something "always on" in python as it is not able to properly free ram and will cause to slow down your system! Is the daemon running in background coded in python?

cb22 2010-04-30 20:58

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by chemist (Post 635068)
Afaik you should not hack something "always on" in python as it is not able to properly free ram and will cause to slow down your system! Is the daemon running in background coded in python?

Hmm? I thought Python's garbage collection was rather good.

lostinmirkwood 2010-05-04 21:17

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by mbo (Post 635060)
i've managed to build my app with dh_pysupport and it seems to load faster now.

.pyc files were build. Is there a significant difference to .pyo files?

mbo, I browsed your source code but couldn't see how you built with it, I added dh_pysupport to my build file but I'm not to certain how to edit the postinstall?

mbo 2010-05-04 21:56

Re: Making Python faster (for fmms initially)
 
i'm using a hacked version of py2deb. I added python-support to build_depends and depends in debian/control and dh_pysupport to debian/control. It's important to add the path of your installed app to dh_pysupport. e.g. "dh_pysupport /opt/your-package", because your module will not be installed in a standard public path.

i've used the extras-assistant to upload the files. If something is wrong with the syntax, the build log will tell you.

The builder runs dh_pysupport and the .pyc files will be added to your .deb.

Editing postinstall was not necessary. I don't know, if this is the right way, but it worked in the end...

attila77 2010-05-05 06:39

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by cb22 (Post 635495)
Hmm? I thought Python's garbage collection was rather good.

"Know thy garbage collector". No garbage collector is perfect, and Python's is no exception. It would be unfair to say that it leaks constantly and can't properly free memory - I would rather say you have to be just a little bit careful with your references and all will be well even in the longest running processes.

Khertan 2010-05-05 06:43

Re: Making Python faster (for fmms initially)
 
Quote:

Originally Posted by chemist (Post 635068)
Afaik you should not hack something "always on" in python as it is not able to properly free ram and will cause to slow down your system! Is the daemon running in background coded in python?

The python garbage isn't weak ... there is just some things that are not auto release and you should do it yourself as there is a purpose to not release it. (read the documentation) :)

Personnaly i use : python -m compileall /home/opt/pygtkeditor in my post install script of pygtkeditor


All times are GMT. The time now is 20:53.

vBulletin® Version 3.8.8