+ 1
How to make a Java Program efficient and affordable ?!
3 ответов
+ 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