All the comments I've seen so far comparing C/C++ and .NET (specifically C#) have been *very* subjective.
Lack of pointers in a language does not guarantee an improvement in quality. C# may remove dealings with pointers in the general case; but, that does not mean programmers working in "pointer-full" language always leave them dangling. There are many good "smart" pointer classes in C++ that deal with the garbage-collection for you. There's also no guarantee that GCed languages remove all allocation- related performance issues. There are cases where GC actually reduces performance. Similarly, there's no guarantee using C# will reduce your development effort. If you have to deal with OS calls that aren't directly supported by .NET, and PInvoke rears it's head; you can probably throw development- time increases (and performance) out the window. OS-based SNMP support is a good example. Try doing that in C# (out-of-the-box) in less time than C++. There's also no direct correlation to object-oriented languages and an automatic reduction in performance. Any high-level language hides aspects of implementation that may have a performance impact. That doesn't mean logic can't be "correctly" written so no performance issues are introduced, in comparison with other languages. Any language will allow you to compromise many aspects of an efficient program (memory usage, performance, resource usage, etc. etc. etc.). There's nothing inherent in C# or .NET that would suggest an application utilizing complex mathematical calculations would be slower than C++ or C. Your choice of libraries in C#/.NET may have different performance footprints than similar C/C++ libraries; but, you're comparing apples and oranges. Language comparisions are always a meal best served with a grain of salt. http://www.peterRitchie.com/ On Mon, 11 Jul 2005 16:01:33 +0300, Kamen Lilov <[EMAIL PROTECTED]> wrote: >Also, the bug rate when not using pointers drops dramatically. > >-----Original Message----- >From: Unmoderated discussion of advanced .NET topics. >[mailto:[EMAIL PROTECTED] On Behalf Of Ben Kloosterman >Sent: Monday, July 11, 2005 3:11 AM >To: [email protected] >Subject: Re: [ADVANCED-DOTNET] Is C++ better over .NET Math library ? > >Hi Vijay, > >I used to be a C++ programmer, but hate it now as I much prefer C#. The >framework is always slower than native though the rate varies between 1 >and 80%. The normal rate I see quoted is about 14% slower. When it is >slowest is when there is no API Ie if you want to work with a bitmap you >need to make a call to get each pixel , hence it is best to pinvoke a >native here. > >The thing about programming in .Net though is it takes you half the time >or less. You can use the extra time to think up smarter algorithms, use >caching etc giving you an overall better performance. > > >Regards, > > Ben > > > >> -----Original Message----- >> From: Vijay M [mailto:[EMAIL PROTECTED] >> Sent: Saturday, 9 July 2005 4:02 AM >> To: [email protected]; Ben Kloosterman >> Subject: Re: Is C++ better over .NET Math library ? >> >> Ben, >> >> Thanks for the tip. Performance is very important for the code i am >> writing but thought that a OO programming platform would ease the >> development a little bit. Oh well. Guess i do have to do it in C or >> Fortran. >> >> I imagined that .NET 2.0 would bring in lots of performance >improvements >> in the framework or that's what i remember reading in one of the blogs >at >> MSDN. But like you said, a procedural language will definitely be >faster >> than any of the OOP languages, anytime ! >> >> Thanks for all the help guys. >> >> On Fri, 8 Jul 2005 12:47:26 +1000, Ben Kloosterman >> <[EMAIL PROTECTED]> wrote: >> >> >If you are doing lots of iterations and care about performance you >are >> >probably best of writing in C . I once converted a compression >program >> >from C to C++ and the performance halved because of the class call >> >overhead (even trying to maximise in lining) . >> > >> >Ben >> > >> >> -----Original Message----- >> >> From: Unmoderated discussion of advanced .NET topics. >> >[mailto:ADVANCED- >> >> [EMAIL PROTECTED] On Behalf Of Vijay Mahadevan >> >> Sent: Friday, 8 July 2005 12:38 PM >> >> To: [email protected] >> >> Subject: Re: [ADVANCED-DOTNET] Is C++ better over .NET Math library >? >> >> >> >> Dixon, Thanks for the link. The article was useful but very broad >> >> based on all scientific applications. It has some good tips on >> >> maximizing and optimising the memory used in a virtual environment >> >> while using arrays, vectors and matrices. Though it is part of what >i >> >> need, it doesn't answer my question entirely. I am also looking for >> >> improving performance in Math section of .NET libraries and if it >can >> >> be made to perform comparably to C++. >> >> >> >> William, Math.NET is a general mathematical library to perform >> >> operations of wide range. I already had a look at the Math.NET code >> >> and think that the library is not designed with speed in mind but >to >> >> be a helper for applications that need to utilize some of the >advanced >> >> math functions. >> >> >> >> Here is something that interested me. >> >> Extreme Optimization Mathematics Library for .NET >> >> http://www.extremeoptimization.com/Mathematics/Performance.aspx >> >> >> >> It is a commercial product but a look and an option to change the >code >> >> would be much more helpful. >> >> >> >> Has anyone dealt with Vectors and Matrices extensively in any of >your >> >> projects ? Do you have a C# implementation of the same and can you >> >> redirect me to a place where there is any info on that ?! >> >> >> >> Anyway, thanks a lot for the replies guys ! >> >> >> >> On 7/7/05, William Bartholomew <[EMAIL PROTECTED]> wrote: >> >> > You may want to look at: >> >> > >> >> > http://www.cdrnet.net/projects/nmath/ >> >> > >> >> > On 7/8/05, Vijay M <[EMAIL PROTECTED]> wrote: >> >> > > Hi everyone. >> >> > > >> >> > > I currently have a numerical simulation code working in MATLAB. >> >The >> >> code >> >> > > is for a scientific application and the complexity involved >till >> >now >> >> has >> >> > > not been much. The simulation is based on solving a non-linear >> >system >> >> > > which involves lots of iterations, the primary method being >> >Newton's >> >> > > method or Fixed point method. Since the complexity has been >> >minimal, >> >> > > MATLAB did support all the requirements but the speed was an >> >issue. >> >> > > >> >> > > Moving on, the next set of requirements involves heavy >computation >> >> with >> >> > > over millions of iterations. I am concerned about the usage of >> >MATLAB >> >> for >> >> > > this scenario and would like to move on to a faster platform. I >> >first >> >> > > considered C++ and then C#. I have worked on .NET for 2 years >but >> >> havent >> >> > > done much work on the Math side of the framework. >> >> > > >> >> > > Now is there a specific reason to choose C++ over .NET for such >an >> >> > > application ? Speed being a important consideration, what would >> >you >> >> guys >> >> > > suggest from your personal experience ? >> >> > > >> >> > > I have lots of calculations with vectors and matrices. So i am >> >also >> >> > > looking for a good implementation of BLAS/LAPACK in C# (If .NET >> >works >> >> > > better !) with comparable performance to its native predecessor >! >> >> Anyone >> >> > > know any ?? >> >> > > >> >> > > Although i do believe benchmarks are useless without the >> >parameters, >> >> all >> >> > > of them do suggest that VC++ is much better than VC#. >Intuitively >> >i >> >> > > guessed that but are there any specific compiler options to >> >optimize >> >> the >> >> > > execution of certain math operations in C# to maximize the >> >performance >> >> ? >> >> > > >> >> > > Sorry for such a long background on what i was doing but felt >that >> >it >> >> was >> >> > > necessary. Thanks for any help you guys can provide. >> >> > > =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
