Performance comparison between JXL and POI FOR excel file generations?

Xls is a binary based format xlsx is an XML based format and requires more work to read/write.

Up vote 0 down vote favorite share g+ share fb share tw.

Here is the code that generates . Xls file using JXL: public void generateXls(String fileName, int sheets, int cols, int rows) { if (cols > 256) { throw new IllegalArgumentException("Error: number of cols per sheet must be 65536) { throw new IllegalArgumentException("Error: number of rows per sheet must be 16383) { throw new IllegalArgumentException("Error: number of cols per sheet must be 256) { throw new IllegalArgumentException("Error: number of cols per sheet must be CreateCell(j); cell. SetCellValue(random.nextDouble()*1000); } } } FileOutputStream fileOut = null; try { fileOut = new FileOutputStream(fileName); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { workbook.

Write(fileOut); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { fileOut.flush(); fileOut.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } I wrote a performance test: public static void main(String args) { int sheets =1; int cols = 255; int rows = 20000; long a1 = System. CurrentTimeMillis(); ExcelFileGenerator generator = new ExcelFileGenerator(); generator. GenerateXls("xlsJXL.

Xls", sheets, cols, rows); long xls = System. CurrentTimeMillis()-a1; System.out. Println("xlsJXL: " + xls); ExcelFileGeneratorPOI generatorPOI = new ExcelFileGeneratorPOI(); long a2 = System.

CurrentTimeMillis(); generatorPOI. GenerateXls("xlsPOI. Xls", sheets, cols, rows); long xlsPoi = System.

CurrentTimeMillis()-a2; System.out. Println("xlsPOI: " + xlsPoi); long a3 = System. CurrentTimeMillis(); generatorPOI.

GenerateXlsx("xlsxPOI. Xlsx", sheets, cols, rows); long xlsx = System. CurrentTimeMillis()-a3; System.out.

Println("xlsxPOI: " + xlsx); } The results are: sheets =1 cols = 255 rows = 10 xlsJXL: 133 xlsPOI: 162 xlsxPOI: 645 sheets =1 cols = 10 rows = 255 xlsJXL: 130 xlsPOI: 140 xlsxPOI: 650 sheets =10 cols = 255 rows = 255 xlsJXL: 611 xlsPOI: 784 xlsxPOI: 16228 sheets =2 cols = 100 rows = 10000 xlsJXL: 2755 xlsPOI: 3270 xlsxPOI: Exception in thread "main" java.lang. OutOfMemoryError: Java heap space any reason by creating . Xlsx with POI is much slower than creating .

Xls? Java performance apache-poi jxl link|improve this question asked Jan 22 at 18:28AAaa5299 67% accept rate.

Xls is a binary based format, xlsx is an XML based format and requires more work to read/write. Xlsx might also require an in memory document model to parse/build the XML which could be more complex. Finally, xls could be optimised better because it has been supported longer.

– AAaa Jan 22 at 21:06 Not that I know of. There may be other libraries which do it faster. – Peter Lawrey Jan 23 at 7:53.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions