[Excel] - Excel generation slow when generating the NSData object
[Excel] - Excel generation slow when generating the NSData object
- Subject: [Excel] - Excel generation slow when generating the NSData object
- From: Dev WO <email@hidden>
- Date: Mon, 15 Apr 2013 08:53:10 +0200
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden