473,493 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python too slow?

I'm pretty new to Python, and even newer to Image/Video processing,
and trying to get started on a project similar to GRL Vienna's laser
marker. I found some sample code here http://janto.blogspot.com/2006/01/mo...in-python.html,
but after running the code with the included sample input file, it
seems quite slow (1-2 seconds from start to finish to do the 800 by
600 gif image).

Is there a better way to do color tracking, or is Python just too slow
as an interpreted language to do any effective color tracking?
Jan 9 '08
57 2604
On Jan 15, 1:28 pm, Paul Rudin <paul.nos...@rudin.co.ukwrote:
cokofree...@gmail.com writes:
A lecturer gave me the perfect answer to the question of speed.
"You have two choices when it comes to programming. Fast code, or fast
coders."

Yes, although it's more a continuum than that suggests. The tricky bit
is deciding in each situation where you should be on the continuum.
Ah, it all comes from hindsight! You always realise in the last week
of the deadline you were on the wrong end of the continuum! Problem
solved, panic created! :)
Jan 15 '08 #51
cokofree...@gmail.com:
A lecturer gave me the perfect answer to the question of speed.
"You have two choices when it comes to programming. Fast code, or fast
coders."
I don't believe that anymore, ShedSkin compiles slowly and it has
limitations still, but it shows that it's possible to create a
language with simple short syntax and high running speed at the same
time.

Bye,
bearophile
Jan 15 '08 #52
"Paul Boddie" <pa**@boddie.org.ukwrote:
>>
perhaps in the future another sillly point could be added also, Java has
Jython, while Python doesn't have some thing like PyJava or... perhaps
Py-va
(Python based Java Language).

You could compile Java to CPython bytecode or, in the case of a little
experiment I did some time ago, translate Java bytecode to CPython
bytecode: the CPython virtual machine operates at a higher level and
can support the Java instructions fairly easily, whereas a fair amount
of work is required to support CPython instructions on the Java
virtual machine. I found that the biggest obstacle was probably
treating Java packages like Python packages - something which
admittedly isn't completely necessary, but which would make the thing
more usable at the prompt. Ultimately, I had little need for Java-
based software and thus wasn't motivated into continuing the work,
although Python 2.5 and beyond do provide some conveniences which
might make some aspects of the implementation more bearable.
Wow, serious... what you've done was really, really cool... :)

I was expect there are nobody willing to do to have python runs Java
Language (such as PyPy) over CPython. Perhaps your javaclass does not work
just like as PyPy, but really... it is damned cool to get CPython execute
java byte-code, congratulations...

Salam,

-Jaimy.
Jan 16 '08 #53
On 16 Jan, 02:17, "Jaimy Azle" <ja...@localhost.comwrote:
>
Wow, serious... what you've done was really, really cool... :)
In practice, not that cool. ;-)
I was expect there are nobody willing to do to have python runs Java
Language (such as PyPy) over CPython. Perhaps your javaclass does not work
just like as PyPy, but really... it is damned cool to get CPython execute
java byte-code, congratulations...
Well, the limitations that stopped me working on it are listed on the
page I referenced, so it wasn't that cool in the end. In fact, the
project grew out of just wanting to inspect .class files and pull out
method signatures, but it was so tempting to see whether Java
bytecodes could be rewritten and run in a CPython environment.

I think the benefits of running Java on CPython are significantly less
than those had by running Python on the Java VM (or another VM).
Firstly, who wants to write statically typed code which then runs on a
virtual machine that can't take advantage of the type declarations?
Secondly, isn't it just better to use a virtual machine with just-in-
time compilation and all sorts of security mechanisms if you're
wanting to write the Java code that, when compiled, can take advantage
of all that stuff? In other words: what makes CPython a compelling VM
for the Java programmer?

My perspective now is that it's a lot more interesting to target
Python for virtual machines other than the CPython one because that's
where the performance and functionality benefits are most likely to be
found. And the most important motivation for this: I prefer writing
Python, not Java. ;-)

Paul
Jan 16 '08 #54
co*********@gmail.com wrote:
A lecturer gave me the perfect answer to the question of speed.

"You have two choices when it comes to programming. Fast code, or fast
coders."
"You're either with us, or against us."

George W. Bush


My understanding is that while CPython performance won't be winning
any awards anytime soon, Jython and IronPython are pretty impressive
performers.

Disclaimer: I haven't personally used Jython or IronPython.
Jan 16 '08 #55
On Jan 16, 5:52 pm, Ed Jensen <ejen...@visi.comwrote:
cokofree...@gmail.com wrote:
A lecturer gave me the perfect answer to the question of speed.
"You have two choices when it comes to programming. Fast code, or fast
coders."

"You're either with us, or against us."

George W. Bush

My understanding is that while CPython performance won't be winning
any awards anytime soon, Jython and IronPython are pretty impressive
performers.

Disclaimer: I haven't personally used Jython or IronPython.
Indeed, it is as Paul Rudin said;
"It's more a continuum than that suggests. The tricky bit is deciding
in each situation where you should be on the continuum."
Jan 16 '08 #56
"Paul Boddie" <pa**@boddie.org.ukwrote:
I think the benefits of running Java on CPython are significantly less
than those had by running Python on the Java VM (or another VM).
Firstly, who wants to write statically typed code which then runs on a
virtual machine that can't take advantage of the type declarations?
Secondly, isn't it just better to use a virtual machine with just-in-
time compilation and all sorts of security mechanisms if you're
wanting to write the Java code that, when compiled, can take advantage
of all that stuff? In other words: what makes CPython a compelling VM
for the Java programmer?
I agree, that's why i expecting nobody willing to. But despite of that, at
least what you've done is a proof-of-concept that java byte-code could also
be executed by python.

Salam,

-Jaimy.
Jan 17 '08 #57
In article <60**********************************@v4g2000hsf.g ooglegroups.com>,
Paul Boddie <pa**@boddie.org.ukwrote:
>
I think the benefits of running Java on CPython are significantly less
than those had by running Python on the Java VM (or another VM).
Firstly, who wants to write statically typed code which then runs on a
virtual machine that can't take advantage of the type declarations?
I know it was a rhetorical question, but I wanted to point out
that this is exactly what happens with Java Generics. They didn't
want to update the type system in the JVM, so all the generic types
get thrown out by the compiler in favor of non-generic types, and
casts are inserted as necessary. Practicality wins over Purity
again.

Gary Duzan
Motorola HNM
Jan 17 '08 #58

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

Similar topics

22
3372
by: Max M | last post by:
There is a story today on Slashdot Open Source Project Management Lessons ======================================...
49
2786
by: Ville Vainio | last post by:
I don't know if you have seen this before, but here goes: http://text.userlinux.com/white_paper.html There is a jab at Python, though, mentioning that Ruby is more "refined". -- Ville...
52
3789
by: Neuruss | last post by:
It seems there are quite a few projects aimed to improve Python's speed and, therefore, eliminate its main limitation for mainstream acceptance. I just wonder what do you all think? Will Python...
114
9682
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
50
5648
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
118
6575
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
83
3555
by: Licheng Fang | last post by:
Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include <iostream> #include <string> #include <vector> #include <set> #include...
53
5159
by: Vicent Giner | last post by:
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...
39
2815
by: cm_gui | last post by:
Python is slow. Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is not faster. Neither is Youtube. Facebook and...
0
7157
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
7192
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...
1
6862
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...
0
7364
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...
0
5452
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,...
0
4579
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...
0
3087
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...
0
1397
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 ...
0
282
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...

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.