Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Akhter Rasool
8,597 PointsMaking applications faster
When some one says, they've made their application 3x faster, does it mean that they've reduced the number of lines of code?? (not effecting functionality) ? What does it mean? Like Apple says, we've made 3x faster, and stuff, please explain how to make applications faster?
7 Answers
Steven Parker
244,190 Points Claims like "we've made our application 3x faster" are often a bit exaggerated and/or based on atypical benchmarks. But if honest measurements are applied, it should mean that application should complete the work it is typically expected to do in 1/3 the time that it did before. Something that took 6 seconds to complete should now take 2, for example.
This has nothing to do with code size. It's quite common for an application to become larger and faster at the same time, when the additional code implements a new strategy that is more efficient.
Now if the application in question is intended for a browser, making it smaller can reduce the loading time, but probably will not have much effect on the performance time.
Joshua Kelly
18,830 Pointsby eliminating the amount of variables and functions that are actively running and taking up RAM.
Also by connecting to quick CDN's and using multiple servers to help store and process can help as well. Using more suitable graphics that don't take much RAM can help.
As the technology advances older ways and versions of code, images, etc can be improved. With larger applications this takes time to make more efficient. There could be thousands of lines of code to update just to improve upon something new.
Akhter Rasool
8,597 PointsDoes having functions reduce CPU processing power i.e, the function is compiled once, but when called again and again, already executable code is reused and not the function executes itself again, am i correct?
Steven Parker
244,190 PointsIf you're speaking of desktop or server applications, the compiling has already been done long before you install the program and run it.
Joshua Kelly
18,830 PointsYou also have to be mindful of your variables and whether you have closed functions. with closed functions they have their own little world storing their own set of variables that the browser keeps track of in RAM. They just don't compute and stop. They are actively participating.
Depending on the program there are different types of method to cache a variable to help out. This process seems to be improving the more i learn and read about how difficult this used to be several years ago.
Akhter Rasool
8,597 PointsDo functions help in optimising the program or are they helpful only for development purposes(making it easier for developers to write code), and when can i say my code is optimised?
Steven Parker
244,190 PointsOptimization is more of an ongoing process than reaching a specific goal. The effectiveness of refactoring can be measured with program benchmarks, comparing the new performance with the old. So from that standpoint, any improvement would indicate that the code has been "optimized" by a certain percentage.
Functions are not likely to improve execution efficiency, but they can significantly reduce program size and simplify maintenance. In a language like JavaScript, they are also critical to important programming paradigms like abstraction and encapsulation.
Joshua Kelly
18,830 Pointsyour code is optimized when you can do no more with the technology that you have available to you.
the functions things is merely something to be aware of when you really get down to it. just be mindful of your variables if you are having issues. that is all...
but there are many ways to optimize a program that does not even invole JS or jQuery. Minimization.... using CDNs and more. Updating old code when things change. I don't think anything can every be truly optimized. It always changes and adapts.
Akhter Rasool
8,597 PointsThank you, your answers were helpful!
Zakk George
4,550 PointsZakk George
4,550 PointsUnfortunately this is a topic with many answers. Reducing your code (also known as clean code) CAN be a way to reduce load times, but generally speaking when they are speeding things up for a user, it means that they have altered the logic of the code itself. Better code logic can make it easier and faster for your device to read, thus increasing the speed.
it could also mean the implementation of code libraries into their projects (jQuery for example.)
It would take me an entire day to list all of the things that make your load times faster when it comes to developement.