+ 1
How to make a Java Program efficient and affordable ?!
3 Answers
+ 5
this question is similar to
https://www.sololearn.com/discuss/205677/?ref=app
+ 3
have you copy paste the content ?kiran sahu
+ 1
Most of these recommendations are Java-specific. But there are also several language-independent ones, which you can apply to all applications and programming languages. Letâs talk about some of these generic ones before we get to the Java-specific performance tuning tips.
1. Donât optimize before you know itâs necessary
That might be one of the most important performance tuning tips. You should follow common best practices and try to implement your use cases efficiently. But that doesnât mean that you should replace any standard libraries or build complex optimizations before you proved that itâs necessary.
In most cases, premature optimization takes up a lot of time and makes the code hard to read and maintain. And to make it even worse, these optimizations most often donât provide any benefits because youâre spending a lot of time optimizing non-critical parts of your application.
So, how do you prove that you need to optimize something?
First of all, you need to define how fast your application code has to be, e.g., by specifying a maximum response time for all API calls or the number of records that you want to import within a specified time frame. After youâve done that, you can measure which parts of your application are too slow and need to be improved. And when youâve done that, you should take a look at the second tip.
2. Use a profiler to find the real bottleneck
After you followed the first recommendation and identified the parts of your application you need to improve, ask yourself where to start?
You can approach this question in two ways:
You can take a look at your code and start with the part that looks suspicious or where you feel that it might create problems.
Or you use a profiler and get detailed information about the behavior and performance of each part of your code.
I hope I donât need to explain why you should always follow the second approach.
Read More.https://crbtech.in