Java performance Issues (I)
30 January 2008In this post, I will talk about Java performance Issues briefly.
General
The output of a Java compiler is a bytecode and not an executable code. The Java Virtual Machine (JVM) interprets the Java bytecode at runtime. Most of the modern programming languages such as C, C++ are not interpreted and compiled to the executable code because of the performance concern. When a program is intrepreted, it generally executes slowly when compared with an executable code.
Language constraints
Certain language features in Java such as array bounds checking, run-time type checking, and virtual function indirection bring upon an unavoidable time penalty. Though this is not unique to Java only and these issues are associated with some other programming languages as well. Also there are cretain features not available in Java, viz. Java does not have arrays of structures or a genuine multi-dimensional array, but Java only has an array of references to objects or further arrays. In addition to that without using an object from a Java method you can not return more than one value. Ulimately, Java code makes more heap allocations when compared with some other languages.
Byte code vs. native compilation
There is a difference between performance of JIT compilers and native compilers. JIT compilation takes more time. It is not so good for short-lived applications and for applications which contain large amount of data. However, when a program is compiled to native code, performance of the program can be compared with that achieved by a native compiler. Many JIT compilers support manual inlining of method calls at run time though Java does not support it. Sun’s HotSpot JVM provides support for runtime recompilation. This can improve the prformance of the static compilation considerably.
Related Posts:
- Java built-in data types (performance issues)
- Java IO tasks
- Vector Capacity
- Performance issues related to trigonometric functions , floating point arithmetic and JNI (I)
- Java performance Issues (III) - Garbage collection
- Performance Issues (String Concatenation)
- Java performance Issues (IV) - Hardware interfacing
- Performance Issues (StringTokenizer)
- Performance Issues (adding element to a Vector)
- Benefits of using Final class
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Java performance Issues (I)