为Java提速
上一页 主页 上一层 下一页

Java程序跨平台特性决定了它必须是解释执行模式,导致的直接结果就是效率低下;
包括Java的编译器(Sun的JDK中的javac),也是用Java写的,每次编译Java源程序,都要使用Java来编译,速度可想而知;
如果使用Java程序进行大量的IO/运算,将是不划算的;
对于数据库的使用,因为大部分数据整理的操作是在数据库端执行,Java负责提出问题和得到结果,效率瓶颈就不在Java端了。

现在有两种Java工具:

使用C++编写的Java编译器
IBM的Jikes,速度比JDK的javac快过10x的数量级。
http://oss.software.ibm.com/developerworks/opensource/jikes/project
可以把Java程序编译为可执行文件
Redhat的一个项目,正在开发中,我前两天发现后Download下来竟然编译脚本错误。
http://sources.redhat.com/java
What is GCJ?
GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile...
Java source code to native machine code,
Java source code to Java bytecode (class files),
and Java bytecode to native machine code.
Before executing your compiled application, you must link it with the GCJ runtime, libgcj, which consists of...
the core class libraries,
a garbage collector library,
an abstraction over the system threads,
and, optionally, a bytecode interpreter.
The addition of the bytecode interpreter means that GCJ compiled applications can dynamically load and interpret class files, resulting in mixed compiled/interpreted systems.

Compiled Java applications are debugged using recent versions of the GNU debugger, GDB. A short tutorial on using GDB to debug GCJ-compiled applications is available.

In addition to regular native programming, GCJ can be configured as a cross-compiler, suitable for embedded systems programming.

Gcj, libgcj, gdb and related tools are Free Software.