Python-like compiled language

Will Ware wware at world.std.com
Mon Dec 11 19:11:27 EST 2000


Alexander Lawhead (alawhead at vcn.bc.ca) wrote:
> I'm a new programmer...
> trying to find a Python-like compiled language that
> would be faster than Python+NumPy.

It usually turns out with software that most of the time is spent
in one, or a very few, time-critical portions. This means that the
rest of the code is relatively insensitive to your efforts to speed
it up, and those efforts (outside the narrow time-critical regions)
will be time wasted. So programmers have developed tools called
profilers to determine where code is spending its time. Before you
undertake a Herculean challenge of learning a new language and
rewriting your entire program in it, you might want to profile the
code you're using now, and look at the parts of it that are taking
the most time to see if they can be sped up.

I haven't studied NumPy and I don't know anything about your application
but I suspect that the authors of NumPy have gone to great pains to
optimize the things that are likely to take up time in your code.
There might not be much to gain by throwing away Python and replacing
it with compiled code. This is actually not such bad news: as long as
you stick with Python, you have all the comforts and conveniences
Python offers you, many of which will disappear if you go to a fully
compiled situation.

It might make sense to contact the authors of NumPy to discuss where
further optimizations could be fruitful. Konrad Hinsen and Paul Dubois
spring to mind as likely suspects.

As far as a language recommendation, mine would be either C or C++.
Not too long ago, Fortran compilers were still significantly better
than available C compilers, but I think C/C++ has been catching up
(beware of ignorance; I never use Fortran). In any case, C and C++
are wildly popular languages throughout the computer science world,
whereas Fortran has retreated to various niches such as scientific
calculation, and its days are probably numbered even there. And if
none of those reasons interests you, Python's source code (and the
source code for many other non-C languages) is written in C.

-- 
# - - - - - - - - - - - - - - - - - - - - - - - -
# Resistance is futile. Capacitance is efficacious.
# Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list