Python太慢了? [英] Python too slow?

查看:85
本文介绍了Python太慢了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python的新手,甚至更新的图像/视频处理,

并试图开始类似于GRL维也纳激光的项目

标记。我在这里找到了一些示例代码 http:// janto.blogspot.com/2006/01/mo...in-python.html

但是在使用包含的示例输入文件运行代码之后,它就是

看起来很慢(从开始到结束需要1-2秒才能通过

600 gif图像完成)。


有没有更好的方法要做颜色跟踪,还是Python太慢了

作为解释语言进行任何有效的颜色跟踪?

解决方案

do**********@gmail.com aécrit:


我是Python的新手,甚至更新的图像/视频处理,

并试图开始类似于GRL的项目维也纳的激光

标记。我在这里找到了一些示例代码 http:// janto.blogspot.com/2006/01/mo...in-python.html

但是在使用包含的示例输入文件运行代码之后,它就是

看起来很慢(从开始到结束需要1-2秒才能通过

600 gif图像完成)。


有没有更好的方法做颜色跟踪,



没有这个领域的经验,我不能对此发表评论。


或者Python太慢了

作为解释语言



正在解释是一种实现的质量,而不是

语言。并且Python(CPython)的参考实现不是解释的,它被编译为字节码,然后由VM执行
(就像Java一样) )。因此,虽然CPython对于你的
应用程序来说可能太慢了(对于某些任务来说确实有点慢),原因

在其他地方(提示:如何编译器)安全地优化

语言中的任何东西都是动态的,即使是对象的类也可以在
运行时更改?)...

< blockquote class =post_quotes>
做任何有效的色彩跟踪?


感谢您的澄清。


虽然我希望有人能给我一个明确的答案。我最初对这个项目感到非常兴奋,但看到实际的执行时间实际上是一个很大的下降。看到GRL Vienna的原始激光标记

是在Processing中完成的,据我所知建立在
Java上,我希望Python能达到类似的效果。任务。


做**** ******@gmail.com 写道:


我是Python的新手,甚至更新的图像/视频处理,

并试图开始一个类似于GRL维也纳激光

标记的项目。我在这里找到了一些示例代码 http:// janto.blogspot.com/2006/01/mo...in-python.html

但是在使用包含的示例输入文件运行代码之后,它就是

似乎很慢(从开始到结束1-2秒,通过

600 gif图像完成800)。



你有没有想过你的申请?你知道瓶颈和瓶颈的原因吗?您的应用程序IO,内存或CPU是否绑定了?b $ b?您是否考虑过用C改写瓶颈?


Christian


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?

解决方案

do**********@gmail.com a écrit :

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,

Not having any experience with this domain, I can''t comment on this.

or is Python just too slow
as an interpreted language

Being "interpreted" is a quality of an implementation, not of a
language. And the reference implementation of Python (CPython) is not
interpreted, it''s compiled to byte-code, which is then executed by a VM
(just like Java). So while CPython may possibly be too slow for your
application (it can indeed be somewhat slow for some tasks), the reasons
are elsewhere (hint: how can a compiler safely optimize anything in a
language so dynamic that even the class of an object can be changed at
runtime ?) ...

to do any effective color tracking?


Thanks for the clarification.

Though I was hoping someone could give me a definitive answer. I was
quite excited about this project initially, but seeing the actual
execute times was a big downer. Seeing that the original laser marker
by GRL Vienna is done in Processing which from what I know is built on
Java, I was hoping that Python would be up to a similar task.


do**********@gmail.com wrote:

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).

Have you profiled your application? Do you know the bottle necks and the
reason for the bottle necks? Is your application IO, memory or CPU
bound? Have you considered rewriting the bottle necks in C?

Christian


这篇关于Python太慢了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆