The Impact of I/O on Application Performance
The impact of I/O on application performance within a Java program “are excellent candidates for performance tuning. One of the more common problems in Java applications is inefficient I/O. A profile of Java applications and applets that handle significant volumes (Lord, N.d.)”. The following information is on a current Java program that has been altered to provide a different strategy for sorting data.
The current java program is set to the following I/O classes: “BufferedReader, File Reader” (not to mention all the other classes associated with I/O and Java). These two classes in particular are being addressed because of the slight modification to initiate a different strategy.
The “FileReader class” is specific in that the “constructors of this class assume that the default character encoding and the default byte-buffer size are appropriate. And FileReader is meant for reading streams of characters. For reading streams of raw bytes, use FileInputStream (FileReader, N.d.)”.
By implementing this new class added that changes the size as in “the character size”. A new code was added to the program in order to change as it “defines a byte buffer instead of char buffer” (JavaTip, N.d.). Also, “a new constructor was added with an additional parameter to specify the size of the buffer” (JavaTip, N.d.).
Because the size “may be by default or may require a corresponding read request to be made of the underlying character or byte stream (BufferedReader, N.d.). The new strategy for the follow java program has improved the efficiency in the manner that the “new JDK 1.1 improves I/O performance with the addition of a collection of Reader and Writer classes. The readLine method in BufferedReader is at least 10 to 20 times faster than the one in DataInputStream when a large file is encountered (JavaTip, N.d.)”.
The purpose of this change and how it may improve the performance is mainly with files that are not “buffered” and that the class “RandomAccessFile is not buffered. The new class is named Braf (Bufferedrandomaccessfile) (JavaTip, N.d
With these few little adjustments the sorter should run more efficiently as it reduces the buffer size of the files that may be “called”.