Java I/O Wish List
I'm collecting wish lists from people who have opinions about what
needs adding to Java's I/O classes. Here's the list so far.
Eventually I'd like to have a microbenchmark for each one showing
the improvement it would bring.
Just about anything you could wish for has been wished for.
The Bug Parade lists numerous enhancement requests for I/O enhancements;
some have been unfairly rejected (e.g. "HotSpot will magically optimize this case, so we don't need to fix this"),
but others have thoughtful comments and analyses appended. Here's a list of
enhancements; numbered items are roughly in most-important-first order.
- New I/O: Scalable I/O for sockets and files
- Add nonblocking I/O
- Add unsynchronized versions of buffered byte and character streams. (This is a crying need. MN and many others have requested it.)
- Promote object reuse.
e.g. add an "open" method on streams, allowing clients to reuse stream objects. (MN)
Related pages:
-
{read,write}{Line,Short,Int,Long,Float,Double,UTF} should be made more efficient.
Related pages:
- readLine should take a maxlen parameter to guard against DOS attacks
- Buffered I/O routines need polish
- java.io.Reader and InputStream
-
Add a variant of RandomAccessFile that does some user-space buffering
(right now, every seek, read, and write translates to a kernel call). (MN)
(note: should RandomAccessFile support POSIX pread() and pwrite() calls somehow? In Posix,
these are used in multithreaded programs, and are atomic seek-and-read/seek-and-write calls.)
- Improved filesystem interface
- New I/O: Character-set API
- Misc
Sun's "Benchmarking Hotspot Q&A" mentions a few common problems with microbenchmarks --
e.g. that Hotspot is smart enough to optimize away dead code --
so I'm trying to be careful to make the benchmarks do real work
(e.g. do linecounts and checksums which get printed out).
Related pages