473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pyhton Interpreter Startup time

Hello,

I'm looking at a small app which would need a very quick
startup time for the Python interpreter. It doesn't do much (copying
and caching of files, no GUI) but I need the Python interpreter to start
up very quickly (<1 second on a Windows box). Is there a way to have a
'stripped' down Python interpreter which can start up very quickly on a
windows box. Once thing I was thinking of was to use PyExe to make a
quick startup (does it compile down to C code, therefore not using the
Python interpreter at runtime?). Is this a possible solution?

I observe that the second time I start python it starts up quicker
but I'm assuming that this is dependent on the environment and can't be
relied upon (or something like that).

Thanks, in advance for your help.

Cheers,

Neil

--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 47
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : be**@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com

Jul 18 '05
16 5782
Neil Benn wrote:
<snip>
PYTHON_HOME=c:\ program files\python23
PATH=%PATH%;PYT HON_HOME
<snip>

PATH=%PATH%;%PY THON_HOME%

Just in case someone mentions!

--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 47
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : be**@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com

Jul 18 '05 #11
Neil Benn wrote:
As I said the first load takes 5 seconds and the consecutive loads
take fractions of a second - my assumption is that Windows is caching
something which is not suitable for my needs as it is not predictable
enough.


Neil, are you using Norton Antivirus with autoprotect enabled? I've
seen that cause problems in the past because NAV scans every file as it
is opened and Python loads a lot of file on startup.

Cheers,
Brian
Jul 18 '05 #12
Neil Benn wrote:
Brian Quinlan wrote:

Neil, are you using Norton Antivirus with autoprotect enabled? I've
seen that cause problems in the past because NAV scans every file as
it is opened and Python loads a lot of file on startup.
Good guess but no cigar!!!


Some other suggestions:

1. try running Python with the -v option is seeing if there is any
obvious pause between imports, any imports of uncompiled modules or
any importing of seemingly unnecessary modules

2. check your sys.path for references to potentially slow file systems
e.g. network drives

What version of Python are you using?

Cheers,
Brian

Jul 18 '05 #13
Neil Benn <be**@cenix-bioscience.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
Hello,

I'm looking at a small app which would need a very quick
startup time for the Python interpreter...


On Windows you would be better of running your application as a
service. In this case you do not care about startup time. It can
automatically look for files you need or could have gui interface
(f.e. tray icon with menu).
Jul 18 '05 #14
Peter Hansen <pe***@engcorp. com> writes:
I don't recall the OP in the last thread that discussed this
ever coming back to report on exactly what OS and CPU etc.
he was using, and whether network issues might be involved,
etc, so until someone can prove otherwise, I think it's
safe to assume that anyone with a slow startup on Windows
has a misconfiguratio n or is doing something wrong.


I don't think that's a safe assumption. For example, on a PIII-550
box running NT that I use, the first time I start up Python after a
prolonged absence (typically through a night when a virus scan is run)
it can take several seconds to start. The same holds true if I switch
versions of Python for comparisons (the first time a new version is
run takes a few seconds).

Subsequent executions of the same version are sub-second (albeit not
always by much).

There's no network issues involved (everything referenced during
startup is local), but to be honest, I'm not surprised, as I can
clearly hear my disk getting hit hard, and expect that absolutely
nothing was in the disk cache related to Python, so getting it loaded
and all the initial startup files loaded simply takes some time.

The fact that I experience similar noticeable delays with loading just
about everything else the first time after the nightly outage (e.g.,
the first time Outlook needs to load in IE to display an HTML message
encounters a very noticeable multi-second delay with heavy disk I/O)
makes me doubly think that the nightly virus scan is flushing just
about everything out of cache.

Similar startups on a PIII-333 running a Gentoo 2.4.x Linux install
definitely "feel" a bit faster. For example, using "python -v" on
both systems presents the same list of loaded modules (replacing
posix/posixpath with nt/ntpath under Windows) and then an additional
readline load once the interpreter starts under Linux. However, the
Linux session just streams those module load messages while you can
visually "see" each message coming out in turn with a tiny delay
between them under Windows. I haven't run timing measurements, but
it's noticeable enough that while they might not be major, I'm
confident they are there.

So for whatever reason, Windows does behave a bit more sluggishly than
Linux in my case. Maybe it's the use of the DLL with Windows (don't
know if any relocations have to take place) versus the static binary
under Linux. Maybe it's just slightly better filesystem I/O (my
Windows box may be more fragmented and/or fuller filesystems).
Certainly doesn't affect me in normal operation, but I guess if I was
starting Python very frequently I'd work on it more.

I also don't think there's much room for Python to be at fault at
least in my case - e.g., if anything it's system behavior and not
really local operations Python is performing.

But I don't think it automatically implies that my Windows system is
misconfigured or that I'm doing something wrong. Of course, my
timings aren't the consistent 5+ second startups that some others have
posted about, in which cases I do agree there might be an unexpected
network dependency or something else amiss.

-- David

Jul 18 '05 #15
David Bolen wrote:
Peter Hansen <pe***@engcorp. com> writes:
I think it's
safe to assume that anyone with a slow startup on Windows
has a misconfiguratio n or is doing something wrong.
I don't think that's a safe assumption. For example, on a PIII-550
box running NT that I use, the first time I start up Python after a
prolonged absence (typically through a night when a virus scan is run)
it can take several seconds to start.

[...snip description of how it affects everything else too] I also don't think there's much room for Python to be at fault at
least in my case - e.g., if anything it's system behavior and not
really local operations Python is performing.

But I don't think it automatically implies that my Windows system is
misconfigured or that I'm doing something wrong.


You're quite right. I should have added the qualification that
if *other* software starts snappily, but Python does not, then
it is safe to assume it's a misconfiguratio n or someone doing
something wrong, whereas if all software starts slowly on
that machine then it may just be a sucky machine.

One assumes that those who are posting about Python starting
very slowly and needing faster startup time are not just
complaining indirectly about having slow machines in general.

-Peter
Jul 18 '05 #16
As far as I could see, the startup of python 2.3 is considerably
slower than python 2.2. It is something that really annoyed me when I
first installed Python 2.3 (and I did it in three different machines).
If the startup time is critical for your application, I suggest using
an older version of Python and, if possible, try to use Psyco to
improve its performance.
Jul 18 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4374
by: Kim Gijung | last post by:
Hi all, I'm wondering how the apache server and php interepreter handles request. If one request comes to apache server what is next procedure? if apache server passes the request to php interepreter and php interepreter handles? what if 10 requests comes at same time? apache server forks 10 php interepreter? or php interepreter makes 10 threads for each request?
3
2071
by: morris.slutsky | last post by:
So every now and then I like to mess around with hobby projects - I often end up trying to write an OpenGL video game. My last attempt aborted due to the difficulty of automating game elements and creating a good level editor - I basically needed a scripting language to control the C modules of the game and, after a half-assed attempt or two to make my own, I just gave up. So naturally this seems like a job for Python. Embedding Python...
40
2372
by: castironpi | last post by:
I'm curious about some of the details of the internals of the Python interpreter: I understand C from a hardware perspective. x= y+ 1; Move value from place y into a register Add 1 to the value in the register Move the addition's result to place x
32
3811
by: Pedro Borges | last post by:
Hi guys, Is there a way to improve the interpreter startup speed? In my machine (cold startup) python takes 0.330 ms and ruby takes 0.047 ms, after cold boot python takes 0.019 ms and ruby 0.005 ms to start.
0
2787
by: rcreddych | last post by:
I am getting the following error while deploying a simple Java Stored Procedure. I am using db2 8 and using the IBM Data Studio. I am new to DB2. Your help will be apreciated. CHETR.PROCEDURE1 - Deploy started. CHETR.PROCEDURE1 - Created temporary working directory C:\PROJECTS\IBM\TEST3\workspace\.metadata\.plugins\com.ibm.datatools.db2.routines.deploy.ui\bld1226688205679. C:\Program Files\IBM\DSADM1.2\jdk\bin\javac -classpath...
0
9384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9212
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9779
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9645
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8645
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.