简体   繁体   English

托管代码(C#)与Matlabs和C ++的速度对比

[英]Managed code (C#) vs Matlabs and C++ for speed

I am about to start developing an edge detection system (once I've read through a couple of books, which I'm doing so at good speed), but one thing I am wondering is the speed of an app like Matlabs (which can compile code to C++) vs AFORGE.NET for edge detecton. 我将要开始开发边缘检测系统(一旦我读了几本书,而且速度很快),但是我想知道的一件事就是Matlabs这样的应用程序的速度(可以将代码编译为C ++)与AFORGE.NET进行边缘检测。

Is unmanaged code generally faster? 非托管代码通常更快吗?

Thanks 谢谢

Unamanged code can be faster for some things, but whether it will make a difference in your case is impossible to say without testing it. 在某些情况下,无歧义的代码可能会更快,但是如果不进行测试,很难说它是否会对您的情况有所帮助。 You could try coding a small, but representative, subset of the problem in both C# and C++ to measure the difference. 您可以尝试在C#和C ++中为问题的一个小但有代表性的子集进行编码,以衡量差异。 Of course, making it "representative" (in terms of performance characteristics) is the challenge. 当然,使其具有“代表性”(就性能特征而言)是挑战。

Your first consideration should be to select the most productive language/environment from the set of languages and environments that provide acceptable performance. 您的首要考虑应该是从提供可接受性能的一组语言和环境中选择最具生产力的语言/环境。 Productivity thoroughly trumps performance for the vast majority of computing problems. 在绝大多数计算问题上,生产率都大大压倒了性能。

Another contender, which is highly productive, is Python with numpy and scipy extensions. 另一个富有成效的竞争者是具有numpy和scipy扩展名的Python。 It can make use of LAPACK, which largely mitigates any performance concerns over using Python. 它可以利用LAPACK,从而在很大程度上减轻了使用Python带来的性能问题。

Firstly yes Unmanaged code is generally faster, but how much ? 首先是,非托管代码通常更快,但是多少呢? It depends. 这取决于。 In your case, it shouldn't make much difference. 在您的情况下,应该没有太大的区别。

I can tell you this because very recently a friend of mine developed a edge detection system (to implement a motion detection system i guess), using the AFORGE.Net library. 我可以告诉你,因为最近我的一个朋友使用AFORGE.Net库开发了一个边缘检测系统(我想实现一种运动检测系统)。 And i don't remember him complaining about performance. 我不记得他抱怨过表现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM