How to speed up preparing of reports?
Hello everyone,
we are using FastReport about one year now and we are very happy to have such a powerfull tool.
Currently we have a serious problem with the performance of preparing reports.
It takes a very long time to prepare the report, when the complexity increases.
The preparingtime for a onesided document is about 5-20 seconds.
What part of preparing the frx file is so expensive?
How can we improve the performance, to get an report prepared in under 4 seconds?
Here the background info:
We use Fastreport for generating business documents. The applicationserver creates an
business-object, that contains all the required data.
The Datasource is bound by using:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--> reportX.RegisterData(bo,"View",10) // max Nestinglvl = 10 <!--fontc--></span><!--/fontc-->
This step performs very quick.
The business object for my example only contains one element for each object,
so we have no iteration during the processing based on modeldata.
The Bottleneck shows up at:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--> prepared = reportX.Prepare();<!--fontc--></span><!--/fontc-->
During debugging on my local machine, this takes aprox. 5-6 seconds.
At clients server > 20 seconds.
FRX files contain multiple bands, mostly "Data bands" with head and footer.
Two Bands were filtered (visible=false) using the "BeforePrint" event, like
examples in the manual explains.
One Band uses the filterexpression for the datasource.
The whole report contains aprox 125 elements (Textobjects, Lines, and so on).
Singlepass/Doublepass does no relevant difference. Sometimes the doublepass is faster.
I tried to isolate problem, but the performance was still poor:
- removed all events (BeforePrint, and so on)
- removed iif expressions used in textobjects
- removed usage of external skripts
- split bands with many objects into more bands with less objects
- removed all textobjects, only one textobj per band that displayed "hello" (this was fast [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />) Do you have any suggestions, how the performance can be improved? What could be so expensive? Is there something, that can be done better?[/img]
we are using FastReport about one year now and we are very happy to have such a powerfull tool.
Currently we have a serious problem with the performance of preparing reports.
It takes a very long time to prepare the report, when the complexity increases.
The preparingtime for a onesided document is about 5-20 seconds.
What part of preparing the frx file is so expensive?
How can we improve the performance, to get an report prepared in under 4 seconds?
Here the background info:
We use Fastreport for generating business documents. The applicationserver creates an
business-object, that contains all the required data.
For Example:
BO{
"1-ClientObj": {
"Number" : 1,
"Name" : Foo,
"Phone" : Bar,
}
"1-SalesmanObj": {
"Number" : 1,
"Name" : Henry,
"Phone" : Bar
}
"n-PositionsObj": {
"Amount" : 1,
"deadline" : 1/2/15,
"n-paymentObj":
{
{"Date" : 1/2/15, "amount" : 2},
{"Date" : 2/2/15, "amount" : 1}
...
}
}
...
}
The Datasource is bound by using:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--> reportX.RegisterData(bo,"View",10) // max Nestinglvl = 10 <!--fontc--></span><!--/fontc-->
This step performs very quick.
The business object for my example only contains one element for each object,
so we have no iteration during the processing based on modeldata.
The Bottleneck shows up at:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto--> prepared = reportX.Prepare();<!--fontc--></span><!--/fontc-->
During debugging on my local machine, this takes aprox. 5-6 seconds.
At clients server > 20 seconds.
FRX files contain multiple bands, mostly "Data bands" with head and footer.
Two Bands were filtered (visible=false) using the "BeforePrint" event, like
examples in the manual explains.
One Band uses the filterexpression for the datasource.
The whole report contains aprox 125 elements (Textobjects, Lines, and so on).
Singlepass/Doublepass does no relevant difference. Sometimes the doublepass is faster.
I tried to isolate problem, but the performance was still poor:
- removed all events (BeforePrint, and so on)
- removed iif expressions used in textobjects
- removed usage of external skripts
- split bands with many objects into more bands with less objects
- removed all textobjects, only one textobj per band that displayed "hello" (this was fast [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />) Do you have any suggestions, how the performance can be improved? What could be so expensive? Is there something, that can be done better?[/img]
Comments
I triggered every band event for debugging purpose with a timestamp. If the code behind occours the performance issues, it would be visible in a text element that shows the data.
The attachment shows, that all band events are done in an acceptable time.
First event "Report Title -> BeforePrint" @ second 16.428
Last event "Child SummaryText -> BeforePrint" @ second 17.549
Result: 1.121 sek
Additionaly I took the time before the "report.prepare()" call @ second 11.426
The gap between preparing and first benchmarkable point in the report is 5 seconds.
The report configuration is as follows:
- Second run : false
- Kompression: false
- File Cache: false
- Convert NULL: true
- Textquality: Default
Perhaps this addional info can help to answer the question, how to get my report prepares faster.