I haven't taken a deep look at this
code, but I have one suggestion based on the performance profiling of Jikes
RVM and classpath 0.09 I was doing the end of last week.
Would it be possible to change the native
methods to take the file descriptor as an additional argument? In
the current Java/native breakdown the very first thing most native methods
do is callback via JNI to acquire the fd. This is much less efficient
(at least on Jikes RVM, and I suspect on most JNI-based VMs) then loading
the fd in the Java code and then passing it as an argument to the native
methods that need it. You might need to add a wrapper method in
some cases if the native method is called by other classes, for example:
public native int read();
becomes
public int read() {
return readImpl(fd);
}
private native int readImpl(int fd);