Painfully slow startup

markscottwright at hotmail.com markscottwright at hotmail.com
Mon Sep 11 17:50:13 EDT 2000


Is python typically very slow when starting up?  When I compare a
simple 'hello world' application against perl, python is 2 orders of
magnitude slower on startup.  It's quite noticable - even the smallest
scripts take more than 3 seconds to load and run (this is on a 500mhz
Pentium III running Windows2000).  I'm considering embedding python in
one of our products, but the application is time-sensitive enough that
a 3-4 second load time is unacceptable.  I'm using Python 1.5.2 (from
the Win32 installer - I haven't re-compiled it myself or anything).  I
suspect that my version of python must be configured incorrectly - does
anyone have any clues?

The output from the following program is as follows (times are in Win32
clock ticks, or 1000ths of a second):
python time 3515
perl time 50

The benchmark program:
---------------------------
#include <iostream>
#include <windows.h>

int main()
{
	using namespace std;
	DWORD begin = GetTickCount();

	begin = GetTickCount();
	system("python -c \"print 'python time '\" ");
	cout << GetTickCount() - begin << endl;

	begin = GetTickCount();
	system("perl -e \"print 'perl time ' \"");
	cout << GetTickCount() - begin << endl;

	return 0;
}


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list