Java Bugs - PrintStream enhancement

The java.io.PrintStream class is way too slow. A glance at the source code reveals the problem - the methods "public void print( String s )" and "public void print( char[] c )" are implemented by looping over all the characters in the string or array and calling write() once for each character. The method-call overhead is killing performance.

I wrote a subclass that overrides those two methods with versions that make a single call to write() for the entire string or array. I didn't do a benchmark comparison, but it looked like performance improved by around a factor of 20. See:

http://www.acme.com/java/software/Acme.APrintStream.html
This is a trivial change, completely upwards compatible. I suggest it be incorporated it into the official PrintStream.
Back to bugs.
Back to ACME Java.
Back to ACME Labs.