If C and C++ give the best performance, why do we still code in other languages?
-
If we compare the performance of a couple of major languages like C, C++, Perl, C#, Java, PHP, and Ruby, then we find that the best performance is given by C or C++, then why do we still code in languages other than C or C++ ? For reference look at this: http://benchmarksgame.alioth.debian.org/u64/which-programs-are-fastest.php Choosing a program which performs faster can help us save a lot of computing resources - and thereby make computing greener.
-
Answer:
Computers have reached a point where even "slow" languages run fast enough to make the difference in speed irrelevant in many cases. We have the luxury now of sacrificing some potential performance to use a language that offers better first-class features and more powerful abstractions, which is important because it lets us get more code out the door in the same amount of time. On average, ten working but not-quite-optimized apps will do more total good than two working and really fast ones. If I can write a Python web app in two weeks that would have taken me three months to write in C, those 10 weeks I didn't spend are a huge win. Now I can use them to do something else. Most programs aren't performance-critical. As long as the code is reasonably written, most people won't notice the difference between something written in Python and some optimized code in C++. If you're having performance problems and need to speed something up, the biggest gains will come from improving your data model or moving your code into a better complexity class. Only in rare cases, like search services or high-frequency trading, will removing the relatively small penalties from things like language speed actually be worth the cost. Make it quickly, make it great, make it fast enough to use, and ship it. Anything past that is rarely a good use of your time.
Bulat Bochkariov at Quora Visit the source
Other answers
This is "old-time" thinking. Computers today are about a powerful as the supercomputers of just 15 years ago when people really cared about CPU performance. Today, the most important factor is the ability of a programmer to create error-free code that will operate the same on many different platforms. The only exceptions to this are production platforms where the ability to execute in close to real-time is the object. Even there, the production code is probably not C or C++ or C##, but most often Cobol for business applications, and Fortran for scientific applications. I always bet on the side of Moore's Law that CPU performance and memory size will double every year. It's been true since Gordon Moore and others founded Intel, and even though the mechanisms have changed, it still appears to hold today.
Dick Caro
If a chainsaw can cut down a tree, why do we still have hammers? Performance isn't the only factor when choosing a development language, you also have to consider time and cost.
KC McLaughlin
Development time is more important than the computing resources these days. C/C++ give full access to developers which becomes difficult to handle sometimes so other "safe" languages like C#, Java etc. are preferred. Another reason might be the availability of more advanced tools and IDEs available for high level languages than we have for C/C++.
Muhammad Aatif Ghafoor
It all depends on the type of requirement you have in front. I write and have written code in C/C++, Java, C# .NET, Ruby, JS, HTML etc. The choice between all of these languages is totally dependent on the requirement of what is to be developed. Suppose, I need to write a network driver which will run on TCP/UDP sockets and interact with the device, of course I will choose C/C++ why because no other language will provide me low level support to access system and OS resources. The code written in C/C++ will automatically be faster as there are no wrappers like JAVA, .Net etc and the driver does not need to present UI to user which can be coded independently in another technology. Now if I have the requirement to design web pages I would choose JS and HTML, why because all browser supports the code written them in a very efficient way, plus this technology was developed for rendering web pages so it provides me various tool kits and techniques which will make me code faster with improved performance. If the same work has to be done in C/C++, how would I have done it, I would have to write my own wrappers over C/C++ which will provide me various UI controls, various libraries which will automatically manage my code as C/C++ does not provide effective and automatic memory management and resource management techniques, this would we a great pain area. So when there is already the work done in HTML,JS which if we see is a wrapper over wrappers over the low level technologies like C/C++ why would one go and create his own new HTML and JS. Same applies to requirement when I need to create a window UI or a web service I will choose between JAVA, .NET etc/ depending upon on other dependencies.
Amit Kumar Singh
It's simply not true. Aside from the basic "Hello World" or primitive loop scenarios, any application's performance has much more to do with design and the developer than then choice of programming language.
Mike Katchourine
Nothing is a best approach for all requirements. Everything has its pros and con's. There are hundreds reason to opt php in place of c and c++ for such cases like for web applications, for low costing purpose,for easily availability of resources etc.
Purushottam Kumar
What everyone said, PLUS: There's stuff you CAN'T DO in C/C++. That's right. You're not alone in this world. People wrote browsers, so you need to know HTML and JS. People wrote web servers and infrastructure, so you need to know PHP (Or whatever server scripting etc.). Etc, etc etc.
Yuval Leshem
If racing cars are the most performant automobile around, why do we still drive in Priuses and SUVs? The answer is: the right tool for the right job.
Santoso Wijaya
C/C++ compared with (as in the OP) Perl, Ruby, PHP, including Java which are interpreted/or similar, languages has no comparison. I've stuck with C and C++ because I 'can' get things done with them. One of the reasons C/C++ is still popular is because there are so many older programmers out there now that act as mentors and offer their time to give both help and advice. Java raised it's popularity because it was easier to learn than C++ but when it comes to bottle necking in your code, you just cannot beat a low level language and raw speed. I won't be mentioning assembly coding here. There are many good web programmers out there but how many of them (apart from those that work at google) actually use C++? When it comes to web design, nothing beats a team of one who is a good programmer and another who is good at networking. With the advent of devices such as the raspberry pi and other such devices being introduced into school, we might soon see another breed of good programmers in the near future. During the 80's was a big boon in programming skills from all over the world. Anyway, that's my rant and its late.
Carl Norwood
Related Q & A:
- Why is Obama still using racial issues just before Tuesday?Best solution by Yahoo! Answers
- How can I give the best answer in Yahoo answers?Best solution by Yahoo! Answers
- If man evolved from monkeys and apes, why do we still have monkeys and apes?Best solution by Yahoo! Answers
- Why do foreigners still want to come to Singapore looking for jobs when there are so many jobless people in SG?Best solution by Yahoo! Answers
- What is best performance for my 04 Mustang GT?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.