C ++ vs C #, a choice in terms of performance (VS2010)

I am developing a tool that will be used to read, process and display data. I am confused about my choice between C ++ / C #. I did only console programming in C ++. No GUI or no C #.

I will use VS2010 (required).

I read a lot on the Internet. I understand that when it comes to high performance, C ++ is the best choice. I will tell you what I need:

  • GUI
  • Reading files (one file is about 25 MB, and a total of about 5000 images can be used simultaneously for further processing).
  • Data processing. Mathematical operations basically.
  • Display data. They can be heavy data again. (~ GZ). I am thinking about using OpenGL for this.

I started with a Windows Form application in VC ++. I made a GUI and it was pretty fast. I had some problems reading files. Most of the people around me use MFC (dialogue based). But mostly they work on programming the firmware. They recommended that I develop at the MFC. But I realized that my productivity has declined.

Now its up to me what to use. Therefore, my questions are: for the tasks that this tool should perform, is it worth it to switch to MFC or, better, I switch to C # (or C ++ CLR). Time is not a big problem if I get a significant improvement in terms of performance.

This is the first part of the development. It needs to be expanded later. Keeping this in mind, which is better for future prospects. (We may need to use CUDA for processing if this information is useful.)

I hope I get it. Kindly be careful and ask for more information if necessary.

edits:

Thanks for the clear answers. The read data are binary images (25 MB ~ -35 MB ~ each). 1000s of images are stacked and processed (not all at the same time, but pixel by pixel). I implemented it in MATLAB, so I have a fair idea about this process. Basically, data on statistics and Fourier will be made according to data. Finally, a point cloud is created. I am thinking of using PCL (a cloud point library that is in C ++). They are not very large, as I am showing in MATLAb right now. Files may become larger in the future, so we are moving to a C ++ / C # environment. The displayed data should have features such as selecting points and displaying options for displaying the properties / graphs of that particular point, etc. The graphics are not hard to display, but more important is the ability to select a function.

+6
source share
1 answer

C # and C ++ give almost the same performance unless you talk about a lot of data for a long period of time. In most cases, C ++ can give you a bit of a second over C #; so these are not very big advantages in any daily application.

However, in cases where marginal performance is absolutely important, for example, drivers or video games, milliseconds received and manual memory management offered by C ++ are an obvious advantage. In all other respects, C # is usually easier and faster to write and debug. Managed code means that you should not, in most cases, handle any allocation or deallocation of memory. I also think that it gives a lot of "cleaner" code.

The GUI in .NET runs in WinForms or WPF. Most of them will probably point you to WPF as the obvious choice, because it is a much ... younger technology, in which the main advantage is the use of DirectX, which means that a computer with a high level of access will be much faster to draw an interface.

However, if you plan on displaying a lot of custom information, say, 3D, it may be much easier for you to program a DirectX / OpenGL request directly. You can then use a wrapper such as SlimDX to make your life easier. But you should know that if you have never dealt with such code, learning how to code in DirectX or OpenGL-oriented is actually not an easy task. Only shaders are a special world.

If you can provide more complete information about the processed data and how you plan to display it, we can point you to a more complete solution.

UPDATE:

I assume that in this case you will not find much performance difference between C # and C ++, even if you use an external library for some calculations. Both C # and C ++ can use the same libraries. If the graphics calculations were so heavy, then most likely the best option would be to transfer them to the GPU compared to DirectX / OpenGL, but this would only be if you think that you have minutes or even hours of intensive computing . Thus, it can be simpler and faster to use C #.

+7
source

All Articles