`
zb_86
  • 浏览: 43163 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jdk7 performance improvements

    博客分类:
  • java
 
阅读更多

转:http://geeknizer.com/java-7-whats-new-performance-benchmark-1-5-1-6-1-7/



Java 7 What`s New, Performance Benchmark 1.5 1.6 1.7

 
 

Java is one of the language which has overhauled it’s underneath technology ground-up. Even though, the basic concept of running inside JVM holds good, the way JVM handles Objects, Memory management has completely been revamped.

A lot  changed over 1.4 to 1.5. There were critical compile-time improvements, Runtime smartness and with Java 6 more performance optimizations; Java 7 – the modularity.

Let’s start discussing each aspect of Java 7 which makes it go Loud -

  • Modularization – JSR 294 or Project Jigsaw
  • JVM Support for dynamic languages
  • More New I/O APIs which are nearly finished, includes true asynchronous I/O  and finally a real file system API – JSR 203
  • The native language support for XML. (probable)
  • Safe rethrow – Allows a broad catch clause, with the compiler being smarter on what you’re allowed to rethrow based on what is thrown from the try block. (I had not seen this before but it looks nice)
  • Null dereference expressions – Null checks with ‘?’ syntax similar to Groovy… lettign developers avoid a nest of null checks.
  • Better type inference – Example around generics instantiations, but it was not clear how far the inference would be taken (the more the better in my opinion).
  • Multi-catch - Allows a comma separated list of disjunctive exception types in catch clause.
  • JSR 296 – Swing application framework – It still needs to be easier to create Swing apps.
  • Update: As per Sun Blogs

After much discussion it’s become clear that theSwing Application Framework API as it is today hasn’t reached consensus and we feel still needs further design work done.

Since the SAF API was committed to milestone 5 of JDK7 and that time is already here, this date is now impossible, and we need to decommit SAF from any specific JDK 7 milestone.

The “Small” Sun changes are:

  • Upgrade class loader architecture – Work started in Java 5 and continues to evolve. There are some deadlock issues today in classloader delegation that will be addressed.
  • XRender pipeline for Java 2D – This was an Open JDK Integrators Challenge project,and is an analog to the OpenGL pipeline but much more portable across x11.
  • Swing Updates – JXLayer, DatePicker, CSS styling (maybe) that Ethan Nicholaus (sp?) has been working on
  • JavaFX

Update: Few new Small changes of  “Project coin” are available here.

The “Fast” changes from Sun (This refers to performance improvements):
Hotspot run-time compiler enhancements

  • A couple of concurrency (JSR 166) tweaks (Better support for Multicore)
  • G1 Garbage collector- Leads to much smaller pause times and hopes to replace CMS (Concurrent mark sweep) GC
  • Compressed pointer 64 bit VM
  • MVM-lite – Multiple Virtual Machines will help run isolated applications and allow a kill -9 on a Java application. Mark said it is not clear what problem would be solved, and original project was extremely ambitious, but desire to drag apps out of browser plugin presents a good usage and need for MVM. (This could be moved to a later release)

The Theory and Practical

As far as what changes you’ll see in your day-to-day work, my guess is that the major impact will be stuff like JSR 203 which overhauls the file system API. If JSR 310 is included, then it would also have a major impact on how you interact with any aspect of the date and time APIs. Many of the other JSRs will only impact you if you happen to already do something in that particular area (JMX – JSR 255, concurrency – JSR 166, etc).

The biggest thing most people will notice may be performance. This is my favorite. And that is exactly what I thought about writing, and it expanded the scope to features aswell. As usual, each JDK brings a whole new set of performance optimizations. We’ve already seen some very encouraging results in String performancearray performance, and a new concurrent garbage collector (G1). I suspect many people will find that their existing code will work and run noticeably faster than it did in the past.

Performance

I saw this one about the new features in Java 7:

http://www.ibm.com/developerworks/java/library/j-jtp03048.html

They use MergeSort as an example of how to exploit multiple CPUs for sorting. Java 7 has the nice feature, that it can now decide at runtime, how many threads should be used to solve a particular problem (see the coInvoke part).

However, there is this tricky constant, SEQUENTIAL_THRESHOLD, which is used to decide whether to enforce sequential processing or not. How do you set this value? Well, you set it at design time, even though the example was meant to show how Java adapts at runtime…

The next thing is that the whole array is passed as parameter. No matter what programming language you use, this is a bad design. If Java doesn’t copy the memory, you may have 2 CPUs looking at the same RAM area. If Java has a runtime optimization that detects that 2 CPUs are looking at the same area, and decides to copy the data, it will copy too much data…

I’m not sure this example would perform better on a 4-CPU machine than on a single-CPU machine with the same CPUs…

The basic problem in all this is, that it is extremely hard to find real world examples of parallelization of algorithms that can be optimized to any kind of parallel hardware. Good multi-threading must be done on a functionality level, not on the algorithm level.

Also, every time we add multi-threading to code, we make it more complex. In other words, it comes at a cost. I predict that some of the future performance gains don’t come from making algorithms more threaded, but from changing data structures, reducing memory footprint and simple optimizations. As the price of more performance increases, efforts will be spent where most speed can be gained at the lowest price.

Benchmarking JDK 7

As per Sun, The JDK 7 delivers quite a speed boost over JDK 6 array accesses. For us, this is huge. It’s like another year and a half of Moore’s law for free. Only in software. And you don’t even have to write multi-threaded code.

It’s basically a stress test that I used for ArrayLists, HashMaps, gets, array sets, and simple multiply-add-subtract, arithmetic, and concurrency APIs, Threads.

I installed the following beta release of JDK 7:

> java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b66)
Java HotSpot(TM) Client VM (build 16.0-b06, mixed mode, sharing)

Java has always suffered relative to C/C++ in  matrix multiplication because Java does range checks on every array access (set or get). With some clever static and run-time analysis, we are able to eliminate most of the array bounds checks. They show on matrix benchmarks that this one improvement doubles the speed of the LU matrix factorization benchmark in the U.S. National Institute of Standards (NIST) benchmark suite SciMark 2, which like our clustering algorithm, is basically just a stress test for array access and arithmetic.

I’m pretty excited about the new fork-join concurrency, too, as it’s just what we’ll need to parallelize the inner loops without too much work for us or the operating system.

I decided to take my on Test-check for performance for Java 7 and then compare it with 5, 6.

My tests have been on a Dell D630 Notebook running Windows 7 RTM (32 bit) with an Intel Core 2 CPU (2.4GHz), and 3GB of RAM.

Here are the Benchmark Tests -

Test 1. Add 5 Million String values (each calculated with some complex Math arithmetic)

Test 2. ArrayList <String> with 5 Million insertions (with values from Test1). Insertions are conditional and have additional computation before adding to array.

Test 3. HashMap <String, Integer> with 5 million keys, values. Each key, value pair is being calculated via concurrent thread. (This tread tests both Arithmetic and concurrency capabilities)

Test 4. Printing 5 million items of ArrayList <String> to number of Files (1000) and Reading back again. (Tests multicore concurrency to the edge) My CPU, HDD, RAM all went to Max.

All of these tests were very memory intensive. Heap size varied between 1 – 2 GB during tests, due to large no. of objects. CPU Utilization was sometimes 50% (1 core’s max) and most of the time >70% and in Test3, Test4; CPU touched 100% most of the times.

The Result is mind blowing!

And the Result The Winner is … Java 7

Java 5 <=== 18% faster=== < Java 6 < ===46% faster===< Java 7

Note – This was totally based upon my tests, doesn’t necessarily means it’s for overall Java. The results may vary for different kinds of computations.



Read more: http://geeknizer.com/java-7-whats-new-performance-benchmark-1-5-1-6-1-7/#ixzz2ADBKpAKM
分享到:
评论

相关推荐

    JDK7安装包.zip

    JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip JDK7安装包.zip\JDK7安装包.zip\JDK7安装包.zip\JDK7...

    jdk7 jdk-7u80-linux-x64 网盘下载

    ### JDK 7 (Java Development Kit 7) 版本介绍 #### 一、JDK 7 概述 JDK 7(Java Development Kit 7)是Java平台的一个重要版本,由Oracle公司发布。它是Java SE 7标准的实现,为开发者提供了用于编写Java应用程序...

    JDK7免安装解压包

    **JDK7免安装解压包详解** Java Development Kit(JDK)是Oracle公司提供的用于开发和运行Java应用程序的工具集。JDK7是Java语言的一个重要版本,它在JDK6的基础上引入了许多新特性、改进和优化。在这个“JDK7...

    jdk7-aarch64-uos.tar.gz

    《深入解析JDK7在Aarch64架构下的应用与实践》 在当前的IT行业中,随着国产化软硬件的快速发展,对支持多种架构的软件需求日益增长。JDK7-aarch64-uos.tar.gz这个压缩包文件,便是针对arm64与aarch64架构的Linux...

    ARM64架构下的jdk7,适配最新架构,陈年代码

    在ARM64架构下,JDK 7可能包括对ARM...此外,还有其他社区和开发者为ARM64架构提供了JDK 7的构建版本,例如Arch Linux ARM提供了jdk7-openjdk 7.u261_2.6.22-1包,这是一个OpenJDK Java 7开发工具包,适用于aarch64架构

    jdk-7u80-windows-x64安装包

    jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-windows-x64安装包 jdk-7u80-...

    JDK7 Windows32位

    JDK7是Oracle公司发布的第七个主要版本,它在JDK6的基础上增加了一些新特性,改进了性能,并修复了许多已知问题。Windows 32位版本的JDK7是专门为在32位操作系统环境下运行而设计的,确保了在这样的平台上开发和运行...

    jdk7 32位最新版本,官网下载

    jdk7 32位最新版本,官网下载jdk7 32位最新版本,官网下载jdk7 32位最新版本,官网下载jdk7 32位最新版本,官网下载jdk7 32位最新版本,官网下载jdk7 32位最新版本,官网下载

    jdk7chm,java7帮助,jdk7api,jdk1.7帮且文档

    jdk7chm,java7帮助,jdk7api,jdk1.7帮且文档,jdk7api chm,JDK(Java Development Kit)是Sun Microsystems针对Java开发员的产品。自从Java推出以来,JDK已经成为使用最广泛的Java SDK。JDK 是整个Java的核心,包括了...

    jdk-7u80-windows-x64.exe 【官方下载的jdk1.7、jdk7,windows 64位版】

    Java 7,也被称为JDK 7或Java SE 7 (Java Standard Edition 7),是在2011年发布的,引入了多项重要的新特性和改进。以下是其中的关键亮点: 1. **多语言支持**:Java 7增加了对其他编程语言的支持,如Groovy、Scala...

    jdk7 jdk8 jdk9 jdk10 jdk11 jdk12 jdk13 jdk14 (win-64位) 百度网盘下载

    jdk7 jdk8 jdk9 jdk10 jdk11 jdk12 jdk13 jdk14 (win-64位) 资源共享

    jdk7 jdk-7u80-windows-x64 网盘下载

    ### JDK 7 (Java Development Kit 7) 版本特性及安装指南 #### 一、JDK 7 概述 JDK 7(Java Development Kit 7)是Oracle公司发布的Java开发工具包的一个版本,它包含了开发Java应用程序所需的工具、文档以及库...

    Java JDK 7学习笔记 PDF

    Java JDK 7是Java开发工具包的一个重要版本,它的全称是Java Development Kit,是用于构建和运行Java应用程序的关键组件。这个PDF学习笔记是开发者深入理解JDK 7特性和功能的重要参考资料。以下是对Java JDK 7的一些...

    jdk7下载下载

    JDK7是Oracle公司发布的Java平台的一个重要版本,它的全称为"Java SE 7"(Java Standard Edition 7)。这个版本在2011年发布,引入了许多新特性和改进,旨在提升开发效率和增强程序性能。 1. **多语言支持**:JDK7...

    Jdk7-8-arm.rar

    JDK7和JDK8是两个不同版本的JDK,每个版本都有其特定的功能和改进,对于开发者来说,了解它们的区别和特性至关重要。 首先,JDK7是Java平台的一个重大更新,正式版本为7u40,它引入了多项新特性,如Try-with-...

    jdk7 免安装版 win64

    jdk7免安装版,可以正常使用,有问题可以联系我,JDK(Java Development Kit)就是Java的开发工具包,无论是开发javase,javaee,javaee.是给Java开发者必须用到的开发工具

    JDK 7 下载

    ### JDK 7 下载及其相关知识点 #### 一、JDK 7 概述 Java Development Kit (JDK) 是由Sun Microsystems(后被Oracle公司收购)提供的Java开发工具包,是开发Java应用程序的基础。JDK 7 作为Java SE 7 的标准实现,...

    jdk7 jdk8 jdk9 jdk10 jdk11 jdk12 jdk13 jdk14 (linux-rpm 64位) 百度网盘下载

    jdk7 jdk8 jdk9 jdk10 jdk11 jdk12 jdk13 jdk14 (linux-rpm 64位) 资源共享

    jdk-7u80-Linux 安装包+安装教程

    在这个压缩包里,我们有两个主要的文件:`jdk-7u80-linux-i586.tar.gz` 和 `JDK安装.pdf`。这些文件都是针对Linux操作系统的,特别是对于使用32位(i586)架构的系统。 `jdk-7u80-linux-i586.tar.gz` 是JDK 7更新80...

    jdk7 64位安装版

    《深入解析JDK7 64位安装版》 JDK,全称Java Development Kit,是Java编程语言的必备工具集,为开发者提供了编写、编译、调试以及运行Java应用程序所需要的一切。JDK7是Oracle公司推出的一个重要版本,针对64位操作...

Global site tag (gtag.js) - Google Analytics