Not sure if this will make a difference but I would pull this line out of
the for loop:

String[] s = table.getColumnHeaderCodes();

There is no point re-assigning this every loop iteration.  If for some
reason the array is actually being coppied, then that's expensive.


-----Original Message-----
From: Torbert Brian IT56 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 25, 2002 9:46 AM
To: 'POI Users List'
Subject: RE: Anyone have performance problems?


<CODESNIPIT>
int nextCellNumber = 0;
// Create first row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short)0);

//Display the header columns    
for (int i=0; i<table.getColumnHeaderCodes().length; i++)
{
        txc.getPerfTimer().startTiming("buildCell inner: ");
        String[] s = table.getColumnHeaderCodes();
        HSSFCell cell = row.createCell((short)nextCellNumber++);
        //set style of cell
        cell.setCellStyle(headerStyle);
        // load cell
        cell.setCellValue(s[i]);
        txc.getPerfTimer().endTiming();
}
</CODESNIPIT>

I am using poi 1.5.0 and running the code on a Pentium 3 500mhz w512mb RAM.
This is just a testing server our production server will be faster. In the
code snipit above table is an object which holds a row of Header Columns and
then rows of data.  Here I have just included the print out of the header
column.  The rows are printed out similarly but with a different Cell Style.
I have wrapped the code in the for loop with a timer and ran a test which
included 3 ColumnHeaders. The results were:

buildCell inner: : 71 milliseconds
buildCell inner: : 90 milliseconds
buildCell inner: : 110 milliseconds

So to build the first Row in the workbook it took around 270 milliseconds.
if you multiply that by 1000 rows your talking about 4.5 mins.  Sure enough
when I throw a count around the whole thing i was seeing about 4 mins.  Can
anyone see anything I am doing wrong that would cause this slow down?  90
milliseconds to build a cell seems high.

Thanks

Brian

-----Original Message-----
From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 6:17 PM
To: 'POI Users List'
Subject: RE: Anyone have performance problems?


Look here for an idea of how fast I (a/o we) expect things to run:

http://jakarta.apache.org/poi/tests/junit/

If there are special cases that are slower, I'd like to know.  Please
submit some unit tests.  Perhaps we should start putting performance
constraints on them.  (an assert at the bottom that X seconds haven't
passed perhaps based on some temporal adjustment by machine).

The "reference" machine (in that its the one that generated the results)
is a AMD Athlon T-Bird 900mhz w/512mb -- if you're running something
slower/smaller of course things make take longer, but I think 3-4
minutes for 4000 cells is probably way out there.  I'd like to see some
code.

-Andy

On Mon, 2002-06-24 at 17:54, Hoffman, Jason wrote:
> Yea, that does seem long.  Our biggest problem has been OutOfMemory
errors,
> which were resolved by adding the java commmand line option to increase
the
> heap size.  You might try that, yours may be slow because of memory
> constraints?
> 
> -----Original Message-----
> From: Torbert Brian IT56 [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 4:51 PM
> To: 'POI Users List'
> Subject: Anyone have performance problems?
> 
> 
> Hi -
>       I was wondering what the typical time people experience when
> creating a workbook of about 1000 rows and about 4 columns.  This is
taking
> around 3-4 mins for us to generate.  It seems a little long.  Is this
> normal?
> 
> Thanks
> 
> Brian
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
-- 
http://www.superlinksoftware.com - software solutions for business
http://jakarta.apache.org/poi - Excel/Word/OLE 2 Compound Document in
Java                            
http://krysalis.sourceforge.net/centipede - the best build/project
structure
                    a guy/gal could have! - Make Ant simple on complex
Projects!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to