Page 1 of 1

For faster reports

Posted: Tue Jul 10, 2007 4:39 pm
by Sacha
Hi !

We are trying to speed up our reporting engine and I would like to see what can be done to speed things up on the report side. For now, we are using the following code :

StiReport stiReport = new StiReport();
xmlData.Position = 0;
DataSet dataset = new DataSet();
dataset.ReadXml(xmlData);
stiReport.Load(sessionInfo.SummaryReportPath);
stiReport.Dictionary.DataStore.Clear();
stiReport.Dictionary.Databases.Clear();
stiReport.RegData("Visit", dataset);
stiReport.Dictionary.Synchronize();
stiReport.PrinterSettings.ShowDialog = false;
stiReport.Compile();
stiReport.CompiledReport.Rendering += new EventHandler(OnRendering);
stiReport.Render(false);
stiReport.Print(GetPrinterSettings(sessionInfo));
xmlData.Close();
stiReport.Dispose();

I think there's an optimization possible if I use compiled reports, but I'm not sure what are the implications of using them, is there any other thing we can do to speed things up with this ?

Thanks

Sacha

For faster reports

Posted: Wed Jul 11, 2007 7:44 am
by Edward
Please modify your code in following way:

Code: Select all

StiReport stiReport = null;
xmlData.Position = 0;
DataSet dataset = new DataSet();
dataset.ReadXml(xmlData);

string compiledReportFile = "report.dll";
if (!File.Exists(compiledReportFile))
{
  stiReport = new StiReport();
  stiReport.Load(sessionInfo.SummaryReportPath);
  stiReport.Dictionary.DataStore.Clear();
  stiReport.Dictionary.Databases.Clear();
  stiReport.RegData("Visit", dataset);
  stiReport.Dictionary.Synchronize();
  stiReport.Compile(compiledReportFile);
  stiReport.CompiledReport.Rendering += new EventHandler(OnRendering);
}
else
{
    stiReport = StiReport.GetReportFromAssembly(compiledReportFile, true);
    stiReport.RegData("Visit", dataset);
    stiReport.Rendering += new EventHandler(OnRendering);
}
  stiReport.PrinterSettings.ShowDialog = false;
  stiReport.Render(false);
  stiReport.Print(GetPrinterSettings(sessionInfo));
  xmlData.Close();
  stiReport.Dispose();
Thank you.

For faster reports

Posted: Thu Jul 12, 2007 9:30 am
by Sacha
Wow ! Huge improvement !!!

Thanks a lot ! :)

Sacha

For faster reports

Posted: Thu Jul 12, 2007 9:37 am
by Edward
Let us know, if you need any help.

Thank you.