473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

For a fast implementation of Python

.
What is the fast way for a fast implementation of Python?

--
JavaScript implementation of Python
http://groups.google.it/group/JSython/

Jul 3 '06 #1
8 1956
.. wrote:
What is the fast way for a fast implementation of Python?
Please define "fast".

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Jul 3 '06 #2
Psyco does some JIT compiling of Python, supposedly making it faster.
You do need to think a bit, however, beforehand.
If you really thing that the "speed" of execution is important for your
application, a scripting language such as python may be the wrong tool.
A language such as C++ or Java which is designed to be a compiled
language can be optimized much faster than python because they impose
more rules.

Some more information about what you intend to do with python may help
us guide you better. If its hardcore matrix multiplication, Numpy and
its derivates may help speed your code up.

Bruno Desthuilliers wrote:
. wrote:
What is the fast way for a fast implementation of Python?

Please define "fast".

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Jul 3 '06 #3
cm************@yaho.com <co**********@gmail.comwrote:
Psyco does some JIT compiling of Python, supposedly making it faster.
You do need to think a bit, however, beforehand.
If you really thing that the "speed" of execution is important for your
application, a scripting language such as python may be the wrong tool.
A language such as C++ or Java which is designed to be a compiled
language can be optimized much faster than python because they impose
more rules.
Java generally produces bytecode that is then run by a virtual machine,
just like Python does; yes, Java has many more rules, but in general
they're not ones particularly conducive to optimization -- in fact,
optimization in Java generally hinges on just-in-time code generation
just like psyco performs, and if such JIT VMs optimize better it's
chiefly due to the huge number of person-years that have been devoted to
perfecting them (as opposed to maybe 1 person-year spent on psyco).

C and C++ do usually generate machine language directly, and their tools
(optimizing compilers first and foremost) have enjoyed investments of a
magnitude comparable to Java's (though, by now, Java's getting a lot
more investment); moreover, C++'s rules _are_ heavily optimization
oriented (e.g., no garbage collection -- being responsible for every bit
of memory is a huge chore during application development, and a cause of
many application bugs, but it DOES allow absolute maximal speed).
Alex
Jul 3 '06 #4

Alex Martelli wrote:
cm************@yaho.com <co**********@gmail.comwrote:
Psyco does some JIT compiling of Python, supposedly making it faster.
You do need to think a bit, however, beforehand.
If you really thing that the "speed" of execution is important for your
application, a scripting language such as python may be the wrong tool.
A language such as C++ or Java which is designed to be a compiled
language can be optimized much faster than python because they impose
more rules.

Java generally produces bytecode that is then run by a virtual machine,
just like Python does; yes, Java has many more rules, but in general
they're not ones particularly conducive to optimization -- in fact,
optimization in Java generally hinges on just-in-time code generation
just like psyco performs, and if such JIT VMs optimize better it's
chiefly due to the huge number of person-years that have been devoted to
perfecting them (as opposed to maybe 1 person-year spent on psyco).

C and C++ do usually generate machine language directly, and their tools
(optimizing compilers first and foremost) have enjoyed investments of a
magnitude comparable to Java's (though, by now, Java's getting a lot
more investment); moreover, C++'s rules _are_ heavily optimization
oriented (e.g., no garbage collection -- being responsible for every bit
of memory is a huge chore during application development, and a cause of
many application bugs, but it DOES allow absolute maximal speed).
That's one of those "yes and no" answers. I remember a Java vs C++
performance comparison a few months ago that gave some really
surprising results: for programs that create a lot of 'by reference"
objects
Java is substantially faster than C++!

The reason is that Java's garbage collector is substantially faster
than
malloc. Sure, you can speed up C++ in that scenario by writing your
own allocator, but as you point out that's a substantial effort that
simply
isn't worth it unless you really, really need super performance.

When C++ was designed the latest garbage collector designs weren't
even on the drawing boards; committing to garbage collection would
have been a fairly controversial decision.

The same is true of Python: it spends a lot of time in reference
counting. My suspicion is that getting rid of reference counting in
the 3.x series might lead to a substantial speedup, simplify C and
C++ extension coding and eliminat reference counting bugs.
Interestingly, it doesn't seem to be in PEP 3099, so I suppose the
issue is still open.

If there was a simple way of using a compiler or language switch
in C++ that said: "use garbage collector", then the inherent speed
advantage of compiled over interpreted would come through. As it is,
C++
simply isn't in the speed race for _real_ object oriented programs.
I'm not interested enough to follow the current round of the C++
standardization effort. It might be coming, it might not.

John Roth
>

Alex
Jul 3 '06 #5

.. wrote:
What is the fast way for a fast implementation of Python?

--
JavaScript implementation of Python
http://groups.google.it/group/JSython/
Check this out:
http://codespeak.net/pypy/dist/pypy/doc/news.html

Jul 3 '06 #6
.. wrote:
What is the fast way for a fast implementation of Python?

-- JavaScript implementation of Python
http://groups.google.it/group/JSython/
Follow the PyPy link. The other replies were about increasing
execution speed, not ease of implementation.

Implement the "RPython" part in Javascript, then use
the PyPy project to fill in the rest? That way, you don't
even have to maintain most of it.

http://codespeak.net/pypy/dist/pypy/doc/news.html

Cheers,
Terry
--
Terry Hancock (ha*****@AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com

Jul 4 '06 #7
.
Hi Terry.

I see:
http://codespeak.net/pypy/dist/pypy/doc/news.html
"...by translating RPython to Javascript..."

It isn't an implementation.

--
JavaScript implementation of Python
http://groups.google.it/group/JSython/
Terry Hancock ha scritto:
. wrote:
What is the fast way for a fast implementation of Python?

-- JavaScript implementation of Python
http://groups.google.it/group/JSython/

Follow the PyPy link. The other replies were about increasing
execution speed, not ease of implementation.

Implement the "RPython" part in Javascript, then use
the PyPy project to fill in the rest? That way, you don't
even have to maintain most of it.

http://codespeak.net/pypy/dist/pypy/doc/news.html

Cheers,
Terry
--
Terry Hancock (ha*****@AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com
Jul 4 '06 #8
Pypy aims to become (probably sometime next year) a strong candidate to
replace cpython as the main python implementation.
Its goals are very ambicious and one of them is making it fast.
Some of its developers even think it can get as fast as C, although I
think that if it can get as fast as java, it would be great.

Its other goal is making it flexible and easier to develop and mantain.

Note that the project already produced a tool for writing extensions in
rpython that are, in theory, as fast a C extensions. So we can say that
in some way, the speed goal is already achieved.

Luis

Jul 4 '06 #9

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

Similar topics

18
by: Michele Simionato | last post by:
I posted this few weeks ago (remember the C Sharp thread?) but it went unnoticed on the large mass of posts, so let me retry. Here I get Python+ Psyco twice as fast as optimized C, so I would like...
0
by: Peter Otten | last post by:
There is currently a discussion on python-dev about an extract() function which offers fast access to list items and object attributes. It could serve, e. g., as the key argument of the future...
1
by: Mathias | last post by:
Dear NG, I'm looking for a fast way to produce 2d-noise images with 1/f or 1/f^2 spectrum. I currently generate the noise via inverse FFT, but since I need lots of data (~10^7 for a monte carlo...
14
by: Christopher Subich | last post by:
As a hobby project, I'm writing a MUD client -- this scratches an itch, and is also a good excuse to become familiar with the Python language. I have a conceptual handle on most of the...
20
by: GS | last post by:
The stdint.h header definition mentions five integer categories, 1) exact width, eg., int32_t 2) at least as wide as, eg., int_least32_t 3) as fast as possible but at least as wide as, eg.,...
10
by: javuchi | last post by:
I just want to share some code with you, and have some comments and improvements if you want. This header file allocates and add and delete items of any kind of data from a very fast array: ...
0
by: Neilen Marais | last post by:
Hi. I'm doing a FEM (Finite Elements) code in python. It uses a tetrahedral mesh to represent the geometry. For post-processing one specifies a list of 3D coordinates to calculate field values...
3
by: Magnus Lycka | last post by:
I'm looking for some library to parse XML code much faster than the libs built into Python 2.4 (I'm stuck with 2.4 for quite a while) and I also need XML Schema validation, and would appreciate...
5
by: Janto Dreijer | last post by:
Hi! I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects. Specifically, I have an "edit...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.