Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
As of Java 8, is G1 a better garbage collector than CMS? Is it advisable to make the switch? What kinds of tuning and testing is needed for such a switch?
As of Java 8, is G1 a better garbage collector than CMS?
Possibly depending on your use case and requirements. In Java 9, G1 will be the default. Whether this is a good idea is a matter of opinion.
Is it advisable to make the switch?
Not unless you have a reason to do so.
What kinds of tuning and testing is needed for such a switch?
I would look to your standard load and stress testing you do now. If you don't have such tests, I would write some to reflect what is important to your application.
In terms of tuning, there is lots of options, which ones are best will depend on your use case.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Why is there still deprecated content in JDK like Thread.stop()?
On the documentation site here I can see the method is
#Deprecated(since="1.2")
Since 1.2!
Also, there is a note:
This method is inherently unsafe
So why is it still there? The presence of deprecated code can potentially lead to many issues.
There is a whole page from Oracle talking about deprecation in APIs if you want to read about it, but here is a good snippet which sums up why deprecated functions are still in Java:
Deprecation is a reasonable choice in all these cases because it preserves "backward compatibility" while encouraging developers to change to the new API. Also, the deprecation comments help developers decide when to move to the new API, and so should briefly mention the technical reasons for deprecation.
Eventually, it will be removed, but until there is enough confidence that people are not using programs that still utilse Thread.stop(), they will keep it in there, and just let people know that there are much better options to choose from.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am using JSP/Serverlets for my upcoming web application project. It is high traffic concurrent users web site. There has been many discussion about performance issues of Java 8 and especially in Streams.
Anyone having specific knowledge about performance of streams and whether its advisable to use in High traffic Web Applications so as to not compromise on latency and response time ?
As a general statement, outside of Java 8 Streams, it is pretty much impossible to answer your question as stated because it depends.
If you've got a method that is called hundreds of times per second then you would need to be very careful about performance. You'd want to tune it the best you could. Conversely, if you've got a method that gets called once a day then you likely wouldn't spend too much time optimizing it.
Streams are a useful tool when used correctly and they are easy to abuse. I've seen developers who thought it was a great idea to read an entire database table and use filtering with streams to effectively do a SQL "where" clause. That's a bad design but it honestly wouldn't be seen in the once-a-day method call.
Don't try to make these blanket "this is good or this is bad" statements. Do a good design and use the tools where they are appropriate. Optimize the parts of your application that need it but don't do pre-mature optimizations - you'll never finish the project.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am wondering about the efficiency of small Java applications. I would like to write a small screenshot application that sits in the taskbar tray. Since this application will be very small and always running, is it worth the overhead of having a JVM running in the background all the time? Thank you in advance for any help.
EDIT: Rephrasing question: Is this an example of something that would be better written in an application that could be run natively instead of Java which requires a JVM to run?
As said above, you have to know whether it is worth it.
If you want to minimize the memory footprint of your application have a look at the guide from Oracle:
Tuning For a Small Memory Footprint
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am developing an android application and I need to improve its performance. If I use less variables in each class, would that help me to achieve better performance?
Unless you have a ridiculous amount of variables, you won't notice any difference (and chances are the compiler will optimize redundant local variables away anyway). If you want to improve your application's performance you'd be better served in concentrating on improving your algorithms and reducing the amount of accesses to external resources.
Maybe help performance, but it's better to see this helpful online book about Java Enterprise Performance about java Performance. Memory isn't the only thing play role in performance.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Or will it be possible in the near future? Can they optimize JVM further and implement even gentler garbage collectors, maybe with some support for lower-level interference?
I could have asked the question if it's possible to develop AAA games, but since AAA games use highly advanced game engines, I thought the barrier to overcome here is to have similarly advanced game engines written to the JVM.
Is it likely that in 5 years we will see games like Assassin's Creed, that are optimized to infinity with the help of C/C++ libraries by necessity, written in Java?
For the most part, the intensive work is done on the GPU and these are getting more powerful all the time.
You can use the GPU from Java already and JavaFX does this as well as a number of CV libraries.
A simple way to get gentiler garbage pauses is to create less garbage. You program will run faster as well.
Another effective technique is to move the bulk of your data off heap. For minecraft server this can reduce the heap size by 80% and significantly reduce the frequency and pause time of collections.
http://vanillajava.blogspot.co.uk/2014/06/minecraft-and-off-heap-memory.html?m=1