Rilasciato Java 9 – Novità e Benchmark


Today, Java 9 has been released officially after a long development started in 2014 and is full of new features and optimizations however I’m Chiccodb00 and in this video we’re going to discover them all! Before the video begins, I will put overlay and in description the main arguments I will talk about and its time in the video to be able to jump right the part that most interests you. Let’s begin with the major changes, which I took from the changelog available at the Oracle site if you are curious to read other major changes, just click on the top right corner. The most important novelty, is the fact that now Java will allow you to create “Modules” which are a collection of code and data and this will allow you to get lighter and faster applications at startup as the various classes will not be fully loaded but only the strictly necessary components. The purpose of doing this is to create an application in a modular and accessible (or easy-to-use) way so that developers are able to create and keep their own libraries, frameworks and applications more easily. In addition, it must be scalable, so that it can be used to modularize Java itself. In this way we can make sure that it is necessary explicitly declare the various dependencies, and further specify which parts of the code are accessible from other components and which remains private. The space used by the String object has been reduced by 50% to do so the encoding is automatically chosen based on the content if you encode the characters in UTF-16 (which would occupy 2 bytes per character) or Latin-1 (occupying only 1 bytes per character) however, you can disable this feature through the command JVM -XX:-CompactStrings. A very useful feature for beginners was the addition of JShell which makes Java “Interactive” in this way it is possible to write and execute the “snippets” (short lengths of code that are used to perform a certain task) this could be useful for testing new libraries. Support for Unicode 8 has been added which allows you to write 10,555 new characters Java 8 supported up to Unicode 6.2.0. You can compile code for an earlier version of Java using some parameters in Javac. A linker was added, which is used to assemble and optimize modules and their dependencies The performance of some security features such as RSA has been raised up to 50% and support for SHA3 hash methods has been added. In addition, several execution parameters, which are now obsolete, have been removed also a tool that I have found particularly useful named Visual VM which was used to obtain information about a process in Java (such as CPU usage, RAM and active threads) is no longer included with Java but became a separate program available at the link at the top right. There are other changes I consider to be minor but to list them all it would take hours so I would say to switch to the benchmark. The benchmarks were performed on a clean installation of Ubuntu 4.17 64bit the computer used is a stock Intel Core 2 Duo P8700 4GB of DDR2 RAM with a 2GHz clock and the operating system is installed on a Kingston SSDNow 200. Java 8 and Java 9 have been installed from the official repositories through the oracle-java8-installer and oracle-java9-installer packages and before updating to the new Java the previous installation has been completely removed also once switched to Java 9, all the sources They have been rebuilt with the new compiler. For each element I measured the execution speed in nanoseconds all test results are the result of the average of the execution time of the same code for 5 times. To begin with, I decided to test the fill of an array of integers of 1000000 items with values from 0 to 1000000, and it turns out that the new Java 9 is slower than 12% compared to the previous version. Anyway, to go on I’ve added random values between 0 and 100 in the previously created array here despite Java 8 has the upper hand, the gap was less than 1%. After that I decided to test the speed of the String class taking the first 100,000 values of the Greek and inserting them in a string, then divide the string into pairs of two inserting the result into an array of integers unexpectedly Java 8 used 1.5% less time than the newcomer Later, I ordered the most contented array of Greek couples using some sorting methods such as Bubble Sort, selection sort and insertion sort, and here we begin to notice improvements for the bubble sort we have an increase of about 1%, while for the selection sort we have improved by as much as 6.5% the insertion row didn’t even earn 1% less time. As a final test I decided to encrypt each element of the array containing the Greek PI values with the RSA encryption method, and then decrypt it again The encryption time increased by 7% however, in the decryption time it has been reduced by 59% even better than what was reported in the changelog. Looking at the data I can deduce that the performance is very similar between the two versions because I didn’t make any optimization this is to obtain a measurement as neutral as possible. In my opinion, the new Java will be a turning point, both for modulation and for JShell and as mentioned above, it will simplify the development of future applications. If this video was useful to understand something more interesting about the brand new Java 9, leave a like, otherwise leave a dislike, also if you want to suggest other tests to run, do not hesitate to leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *