Hello again. My participation at ASUOC's meeting was a success, I had my talk about Java 7 on Thursday September 13, and it went pretty well. It was a lot of fun, we had about 30 assistants on site and 1027 visitors online (according to the streaming stats). Few questions were asked at the end of the presentation, I post some of them here, giving further explanation:
Q: Is there really any difference in performance when migrating if-else structures to switch structures?
A: There are a lot of discussions about this topic, but if you look at the decompiled code, you will notice that a switch with String cases is translated into two switches at compile time. In the first one, every case is an if statement and if there are Strings with the same hash code, then you'll get an if-else-if statement. So what if many of your String objects have the same hash code?... You will get a long (depending in your cases) if-else-if statement inside a switch statement and then, the performance of the application may not be the best (but not the worst).
Anyway, I think it is hard to get many String objects with the same hash code in a real scenario, this is a good feature and I'm pleased we have it now.
Q: Do you know if there have been issues with applications compiled for previous versions of Java when running in Java 7?
A: There is a list of Deprecated API that you should be aware of, so you don't use it in your code: Java 7 Deprecated API
On the other hand, some companies publish something called "certification matrix" for their products, so you can know if they can work with some technology, like Java 7. For example, Oracle E-Business Suite is not yet certified to be used with Java 7.
Q: Did you make any change to the NIO.2 example in order to run it in Linux OS?
A: The NIO.2 example was the same for Windows OS as for Linux OS. In Java there's a saying "write once, run everywhere" so you can run the same code in a Windows or Linux machine. Nevertheless, you should know that different file systems have different notions about which attributes should be tracked for a file, as noted in the Managing Metadata (File and File Store Attributes) Tutorial.
Java 7, 1+ año después
That was the name of my presentation and you can download it using this link (in spanish): Download PDF File.
The presentation was also recorded but is not uploaded yet. I will update this post as soon as the presentation is available.
Following you will find the links to the conference (spanish, 01:30 aprox.):Q: Is there really any difference in performance when migrating if-else structures to switch structures?
A: There are a lot of discussions about this topic, but if you look at the decompiled code, you will notice that a switch with String cases is translated into two switches at compile time. In the first one, every case is an if statement and if there are Strings with the same hash code, then you'll get an if-else-if statement. So what if many of your String objects have the same hash code?... You will get a long (depending in your cases) if-else-if statement inside a switch statement and then, the performance of the application may not be the best (but not the worst).
Anyway, I think it is hard to get many String objects with the same hash code in a real scenario, this is a good feature and I'm pleased we have it now.
Q: Do you know if there have been issues with applications compiled for previous versions of Java when running in Java 7?
A: There is a list of Deprecated API that you should be aware of, so you don't use it in your code: Java 7 Deprecated API
On the other hand, some companies publish something called "certification matrix" for their products, so you can know if they can work with some technology, like Java 7. For example, Oracle E-Business Suite is not yet certified to be used with Java 7.
Q: Did you make any change to the NIO.2 example in order to run it in Linux OS?
A: The NIO.2 example was the same for Windows OS as for Linux OS. In Java there's a saying "write once, run everywhere" so you can run the same code in a Windows or Linux machine. Nevertheless, you should know that different file systems have different notions about which attributes should be tracked for a file, as noted in the Managing Metadata (File and File Store Attributes) Tutorial.
Java 7, 1+ año después
That was the name of my presentation and you can download it using this link (in spanish): Download PDF File.
See ya!
No comments:
Post a Comment