I'm having performance problems with Apache POI. I've read the FAQ where it refers to a performance test. I've run this test with logging off and 4gb of heap and I can't get the tests to run faster than 22 seconds.
This is the test I'm running: http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/ss/examples/SSPerformanceTest.java
The FAQ says that if I can't get this test to run in under 3 seconds with 50,000 rows and 50 columns that "the problem is with your environment". I've read other comments around the web referring to disabling poi logging and increasing the heap size, but nothing seems to help.
What else can I check to fix my environment?
Machine Specs (Personal desktop machine):
CPU: Intel i7 8-cores RAM: 16GB OS: Windows 7 64bit JDK: 1.8.0_66 POI: 3.13 JVM Params: -Xmx4g -Xms4g -Dorg.apache.poi.util.POILogger=org.apache.poi.util.NullLogger Command Arguments: XSSF 50000 50 0
I should also mention that the Apache POI jars I'm using came from maven central
I've created a test project on github where you can simply clone the project and run:
mvn exec:java
I hard coded the parameters I'm using so you do not have to enter anything special on the command line. The documentation says this should run in under 3 seconds.
The test project is located here: https://github.com/mikedehaan/poi-test
Advantages. The main advantage of apache poi is that it's support both HSSFWorkbook and XSSFWorkbook.
HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (. xlsx) file format. HSSF and XSSF provides ways to read spreadsheets create, modify, read and write XLS spreadsheets.
Apache POI provides Java API for manipulating various file formats based on the Office Open XML (OOXML) standard and OLE2 standard from Microsoft. Apache POI releases are available under the Apache License (V2. 0).
Test results on my machine:
Machine specs:
CPU: Intel i3-2100, 3.10 GHz, 4-cores RAM: 16GB OS: Windows 7 64bit JDK: 1.7.0_76
I made profiling and found out that XSSF
is slow due to the synchronized methods in xmlbeans
and poi-ooxml-schemas
libraries. You can notify poi developers and ask to check this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With