Hello.
I am new to Python. It seems a very interesting language to me. Its
simplicity is very attractive.
However, it is usually said that Python is not a compiled but
interpreted programming language —I mean, it is not like C, in that
sense.
I am working on my PhD Thesis, which is about Operations Research,
heuristic algorithms, etc., and I am considering the possibility of
programming all my algorithms in Python.
The usual alternative is C, but I like Python more.
The main drawbacks I see to using Python are these:
* As far as I understand, the fact that Python is not a compiled
language makes it slower than C, when performing huge amounts of
computations within an algorithm or program.
* I don't know how likely it is to find libraries in Python related to
my research field.
* I know Python is a "serious" and mature programming language, of
course. But I do not know if it is seen as "just funny" in a research
context. Is Python considered as a good programming language for
implementing Operations Research algorithms, such as heuristics and
other soft-computing algorithms?
Maybe this is not the right forum, but maybe you can give me some
hints or tips...
Thank you in advance.
Jun 27 '08
53 5251
On May 21, 12:01 pm, Bruno Desthuilliers <bruno.
42.desthuilli.. .@websiteburo.i nvalidwrote:
C has proven very difficult to optimize, particularly because pointer
aliasing prevents efficient register allocation.
Does this compare to optimizing something like Python ? (serious
question, but I think I already know part of the answer).
In Python different references can alias the same object. But the
objects for which this is important in C, is typically elementary
types like ints and floats. Pointer aliasing has the consequence that
the compiler often cannot choose to keep an int or a float in a
register inside a tight loop. This will often have serious
consequences for numerical computing. But these elementary types are
immutable in Python, so Python is actually somewhat immune to this.
This is one of several reasons why RPython sometimes can be "faster
than C".
But there are other much more important issues if you are to generate
efficient machine code from Python, e.g. getting rid of redundant
attribute lookups.
On May 21, 11:59 am, Bruno Desthuilliers <bruno.
42.desthuilli.. .@websiteburo.i nvalidwrote:
Strange enough, no one calls Java or C# 'interpreted languages', while
they (or, to be more exact, their reference implementations ) both use
the same byte-code/VM scheme[1].
Java interprets the bytecode in a virtual machine by default. Only
code 'hotspots' are JIT compiled to native machine code.
Microsoft .NET compiles bytecode to native code on the first
invocation, and caches the machine code for later use. Nothing is
interpreted.
Java can benefit from more runtime information when generating machine
code, but incurs the penalty from running an interpreter most of the
time. MS .NET is more similar to a static compiler. They currently
perform about equally well, sometimes approximating traditional
compiled languages like C++.
But they do not use the same bytecode VM scheme. Particularly,
Microsoft .NET has no virtual machine.
You know, Common Lisp is also an highly dynamic language, and there are
now some optimizing native-code Common Lisp compilers that generate very
efficient binary code. It only tooks about 30 years and way more
ressources than CPython ever had to get there...
The speed of Common Lisp with compilers like SBCL and CMUCL comes from
optional static typing. This no more magical than what Cython and
Pyrex already can do. If we remove the interpreter when Cython or
Pyrex supports all features of the Python language, and instead rely
on "JIT compilation" by one oth these compilers, we are already there.
In article <71************ *************** *******@y21g200 0hsf.googlegrou ps.com>,
sturlamolden <st**********@y ahoo.nowrote:
>On May 18, 5:46 am, "inhahe" <inh...@gmail.c omwrote:
>The numbers I heard are that Python is 10-100 times slower than C.
Only true if you use Python as if it was a dialect of Visual Basic. If you use the right tool, like NumPy, Python can be fast enough. Also note that Python is not slower than any other language (including C) if the code is i/o bound. As it turns out, most code is i/o bound, even many scientific programs.
In scientific research, CPU time is cheap and time spent programming is expensive. Instead of optimizing code that runs too slowly, it is often less expensive to use fancier hardware, like parallell computers. For Python, we e.g. have mpi4py which gives us access to MPI. It can be a good advice to write scientific software parallelizab le from the start.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Cheng |
last post by:
I'm curious about something... many Artima.com members who have a Java
background and learned Python have come to the conclusion that Java and
Python are highly complimentary languages. They would never consider
filling the place Java has in their toolbox with Python, but recognize there
are many tasks where it really pays to add Python to the mix.
I want to ask you hard-core c.l.p Pythonistas: Do you use Python for
everything? (and...
|
by: Stephen C. Waterbury |
last post by:
This seems like it ought to work, according to the
description of reduce(), but it doesn't. Is this
a bug, or am I missing something?
Python 2.3.2 (#1, Oct 20 2003, 01:04:35)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> d1 = {'a':1}
>>> d2 = {'b':2}
>>> d3 = {'c':3}
|
by: Lad |
last post by:
Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
|
by: xeys_00 |
last post by:
I posted a article earlier pertaining programming for my boss. Now I am
gonna ask a question about programming for myself. I just finished my
first C++ Class. Next semester is a class on encryption(and it's
probably gonna be a math class too). And finally back in programming in
the fall with C++ and Java 1. The C++ will cover pointers, and linked
lists, sorting algorithms, etc... I run linux and OS X. I have read in
the old days that C was...
|
by: abhinav |
last post by:
Hi guys.I have to implement a topical crawler as a part of my
project.What language should i implement
C or Python?Python though has fast development cycle but my concern is
speed also.I want to strke a balance between development speed and
crawler speed.Since Python is an interpreted language it is rather
slow.The crawler which will be working on huge set of pages should be
as fast as possible.One possible implementation would be...
| |
by: hacker1017 |
last post by:
im just asking out of curiosity.
|
by: Xiao Jianfeng |
last post by:
Hi all,
I am looking for a genetic algorithms package for Python.
I have googled the web before posting and found some links. The link of
pygene(http://www.freenet.org.nz/python/pygene) cannot be opened.
I also tried the recipe on ASPN, but it is too simple for my
application, and the ga model in SciPy, which is in testing in the
"sandbox".
|
by: efrat |
last post by:
Hello,
I'm planning to use Python in order to teach a DSA (data structures
and algorithms) course in an academic institute. If you could help out
with the following questions, I'd sure appreciate it:
1. What exactly is a Python list? If one writes a, then is the
complexity Theta(n)? If this is O(1), then why was the name "list"
chosen? If this is indeed Theta(n), then what alternative should be
used? (array does not seem suited for...
|
by: Jens |
last post by:
I'm starting a project in data mining, and I'm considering Python and
Java as possible platforms.
I'm conserned by performance. Most benchmarks report that Java is
about 10-15 times faster than Python, and my own experiments confirms
this. I could imagine this to become a problem for very large
datasets.
How good is the integration with MySQL in Python?
|
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...
|
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,...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |