I need to read & write a huge amount of strings (each strin line 90 chars long) from/to zipped text file.
There is also time consuming task to prepare the input/output but it can be neglected (IO time is much much bigger (profiled) )
This is the code I am using:
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(file)); out.write((stringData+NewLineConstant).getBytes()); GZIPInputStream in = new GZIPInputStream(new FileInputStream(file)); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in),8192); String data = bufferedReader.readLine(); The problem it takes too much time to complete.
This is also done over multiple files that are used to sort the data (merge sort).
Is there something I can do to improve dramaticallythe performance? (without Hardware change)
BufferedWriter, callnewLine()and remove thatNewLineConstant? You can even reuse a char[90] buffer for callingwrite.