views:

113

answers:

3

Hi,

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.

Is unmanaged code generally faster?

Thanks

+4  A: 

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. Of course, making it "representative" (in terms of performance characteristics) is the challenge.

Evgeny
I actually thought there was some hard-and-fast rule, but your post implies it is down to individual characteristics. Thanks.
dotnetdev
Well, put it this way: it's unlikely that the managed code will be FASTER. It will probably be slower to some degree, but depending on what you do the difference may or may not matter. Eg. if you're accesing array elements in a REALLY tight loop then the managed code's bounds checking MAY make a difference.
Evgeny
+3  A: 

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. It can make use of LAPACK, which largely mitigates any performance concerns over using Python.

Marcelo Cantos
+1  A: 

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. And i don't remember him complaining about performance.

Vivek Bernard