r/learnjava • • Aug 14 '25

Why are profiling tools so unknown even for 10+ years of experience folks?

I don't understand it. People just don't have any interest in how their app works? Isn't there any light of curiosity about the resources that are being used by their app and why?

If you go to jdk > bin you can see a ton of tools, does anybody care about what are they and what they do?

Like, really, they are just right there, and you can use them from your terminal the moment you install your JDK and configure your JAVA_HOME and PATH. Am I tripping? or do I simply just happen to not know people who actually care about this kind of stuff?

1 Upvotes

13 comments sorted by

•

u/AutoModerator Aug 14 '25

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions

  • You include any and all error messages in full - best also formatted as code block

  • You ask clear questions

  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/aqua_regis Aug 14 '25

People care about them when they need it, i.e. when they figured that they have a bottleneck somewhere that needs optimization.

Just running them because you are interested is your thing. Yet, running them to just optimize without a real need is premature optimization (see Donald Knuth: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.")

To be fair, unless you are running some extremely time sensitive or memory consuming algorithms, you will rarely ever really need to optimize and hence, you will rarely need these tools.

2

u/[deleted] Aug 14 '25

As I see it, there is no way for you to know if there is a memory leak unless it is bad enough to breaks stuff if you don't regularly profile your apps.

I see the point of quoting Donald Knuth, but you may also agree with me that we've reached the point where nobody cares about the resource hunger that makes Java famous among its detractors.

3

u/Ruin-Capable Aug 14 '25

Most resource leaks can be caught by static code analysis, and having a true memory leak is rare (at least on the projects I've worked on). So many developers view profiling primarily as a performance bottleneck diagnostic tool.

1

u/[deleted] Aug 14 '25

[removed] — view removed comment

1

u/[deleted] Aug 15 '25

getting a live class histogram I noticed we kept alive way more objects that we should and that we were doing way too many stop the world GC (which we are currently working on atm)

1

u/[deleted] Aug 15 '25

[removed] — view removed comment

1

u/[deleted] Aug 15 '25

No, and that's why I wrote this post. You may think your app is doing good just because you are used to its times, but benchmarking your methods doesn't give you any hint about why they last that amount of time in execute. So, if you simply benchmark, you can believe everything is fine when, in reality, there may be stuff happening deep inside your JVM that you may not notice just by "checking your code". That's why profiling is important IMHO

1

u/[deleted] Aug 15 '25

[removed] — view removed comment

1

u/[deleted] Aug 15 '25

Well, I don't believe you have to stick with one or the other, they are not exclusive. We both can be right at the same time.

But I am worried about something, and it is the mediocrity. I feel like everyone is ok if the app "just works", and I don't like it. If you can do it better and you have the time and resources to do so, you should. Also, if you can do it better right from the very beginning... don't be conformist/lazy, just do it well. Nobody cares about resource usage, 200MB JAR/WAR is somehow acceptable because who cares, its not like it will increase the invoice. ¿Threads? Lets add them whenever we feel like it, even when there is a risk to slow down not only the app itself but also any other app deployed in the same machine.

We should do better.

2

u/[deleted] Aug 15 '25

[removed] — view removed comment

1

u/[deleted] Aug 15 '25

Wise words, I will take the time to think about my priorities. Thank you so much.