Does inefficient code cripple the performance of an app?
-
I am not a programming geek, so I could easily foresee writing an app with long lines of code. I was wondering whether there is any difference in performance between smartly-written code and amateur code.
-
Answer:
It depends on whether your app is performance-sensitive. For example, code on a web server where multiple people call it simultaneously often needs to be written to be very efficient. But if it is a client side app, and no one is complaining about performance, then you might be OK. There is a saying, "Premature optimization is the source of all evil". In other words, first worry about getting your logic so your app works correctly, i.e., gives the right results. Then if it is too slow, optimize the parts that are slow.
Rob Weir at Quora Visit the source
Other answers
It depends on where the code is. If the code gets called rarely, it is unlikely to cripple an application. If you are calling the code constantly, and it is wasting cycles, it is possible that you may deliver a poor user experience.
Tristan Irwin
I can offer an example from many years ago, when it was easy to measure performance. We had an application that was so badly-written that it gave continuous errors, so I asked a member of the team to rewrite it (if you think it might need re-writing, believe it - it does). The original (batch) program took over four hours to run, and the replacement took 30 minutes - and eliminated the errors from the first program. To an extent, that's the difference between a good programmer and a bad one. The second version wasn't particularly optimised but it was written by an experienced programmer who organised his logic properly.
Doug Scott
Innefficient code is likely to slow an application down, but in truth most applications spend 99% of their time waiting for user input or waiting for data to arrive from the database so the inneficiency of a particular piece of code may never actually be noticed. So it really depends on the number of users/amount of traffic your app will have to cater for. I kind of agree with Rob - people can worry too much about performance too early on, although my counter argument would be that 80% of performance is in the orginal design of the application... so a well designed application with bits of inefficient code is likely to be easier to fix than one that is badly designed. There are some obvious areas where code efficiency is crucial; in embedded systems, for example, developers often measure precisely how many CPU cycles a given function will require, and then agonise about finding smart ways to reduce the number.
Gary Barnett
Related Q & A:
- Can you prevent another app from opening within your app?Best solution by Stack Overflow
- How to implement app purchase in Android app?Best solution by Stack Overflow
- How to connect Android app to App engine?Best solution by groups.google.com
- Why is public transportation in India so inefficient?Best solution by Yahoo! Answers
- Why medical care is a potentially inefficient market?
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.