[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python init (was: bash vs. python scripts - which one is better?)



On Tue, Aug 21, 2007 at 02:07:23PM -0400, Rick Thomas wrote:
> On Aug 20, 2007, at 10:45 PM, Steve Lamb wrote:
> 
> >    When it comes to Python in a role of system initialization  
> >there are some very simple things one can do that would  
> >dramatically increase load times. First off the pre-compiling of  
> >modules that Python does means subsequent boots would not have to  
> >go through that step.  One could ship the distribution with those  
> >modules pre-compiled and only edits from that point out would be  
> >compiled on their first run.
> 
> Hmmm... Now, that's a problem!  During the early part of the boot  
> process the root filesystem is read-only until it's been fsck'ed.   
> There's no safe place to put the compiled modules.

You don't have to wait until the scripts run to compile the modules.  A
helper script could be provided to be run after any edit of the file(s)
which would simply parse a list of modules to compile and just import
them which automatically compiles them.  If that script is shebanged
with python -OO which would produce .pyo files instead of .pyc.  For
individual files, the person editing them could run python interactively
and import it.

> 
> Not to mention that moving 10 MB of Python from /usr/bin and /usr/lib  
> to /bin and /lib would increase the size of the root filesystem by  
> 10%-20% on embedded systems -- where the size of things that must be  
> in flash is a critical resource.
> 

True.  However, perhaps that 10 MB can be shrunk with some careful
tweaking.

Doug.











Reply to: