Hi List,

I've been doing some measurements regarding an Excel generation.
Almost everything is actually running as expected except when I create the 
NSData object using parser.data().
For example, up to this point of the method, it would take around 2-3 seconds, 
but then it takes around 300 seconds for the data() phase.
Is this something "expected" or is there something I could try to dig to find 
out why it takes that long?

I'm generating an Excel file which will be around 100KB with around 1000 rows 
and less than 10 columns.

Here's the code that generate it:

                ExcelExport export = new ExcelExport(context());
                export.setExcludeValidatedStrings(excludeValidatedStrings);
                
export.setExcludeNeedsValidationStrings(excludeNeedsValidationStrings);
                export.setExcludeNeedsFixStrings(excludeNeedsFixStrings);
                export.setExcludeGlobalKeys(excludeGlobalKeys);
                export.setProject(selectedProject());
                String contentString = 
export.generateResponse().contentString();
                byte[] bytes;
                try {
                    bytes = contentString.getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
                    throw new NSForwardException(e, "Can't convert string to 
UTF-8...you should get a better VM");
                }
                InputStream stream = new ByteArrayInputStream(bytes);
                EGSimpleTableParser parser = new EGSimpleTableParser(stream, 
(NSDictionary<?, ?>)data().valueForKey("Fonts"), (NSDictionary<?, 
?>)data().valueForKey("Styles"));
                stream.close();
                // Up to this point, things are going fast enough, around 3 
seconds
                
                NSData data = parser.data();
                // This takes ages, around 300 seconds

                String fileName = "ExcelExport.xls";
                newResponse.disableClientCaching();
                newResponse.appendHeader(String.valueOf( data.length()), 
"Content-Length" );
                newResponse.setContent(data);
                newResponse.setHeader("inline; filename=\"" + fileName + "\"", 
"content-disposition");
                newResponse.setHeader("application/vnd.ms-excel", 
"content-type");


Any pointer welcome:)

Thanks,

Xavier


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to