I have seen many questions online about Apache POI performance, but none of them is as slow as my case and none of their solutions works for me. I am using NetBeans 8.0.2, JDK 1.8 and POI-3.12-20150511. To read a 300 KB xls (with 3000 rows and a few columns), this line takes 10 seconds to run:
FileInputStream file = new FileInputStream(filename); HSSFWorkbook workbook = new HSSFWorkbook(file); //this line takes 10 seconds
To read a larger one like a 1 MB xls, it could take more than one minutes to create the HSSFWorkbook.
I have tried to disable the POI log and increase the JVM memory by adding these parameters:
They do not help. My machine has 12 GB memory so memory should not be a problem.
I do not know if it is the problem of Apache POI or JVM. But I have imported the 3000 rows data into MySQL, and it takes 2 seconds to read the data from MySQL (versus 10 seconds from Excel).