psTwoPass in PassSetting will cause the degrade of performance if use TppArchiveDevice
Hi!
I have set TppReport.PassSetting = psTwoPass, so i have compared the
performance of two kinds of previewer, one is report builder's native
previewer another is through TppArchiveDevice. Both preview the same
report template with same data. The code shown as below:
Native Preview:
---------------
ppReport1.Print;
Archive Device
--------------
lDevice := TppArchiveDevice.Create(nil);
F := TForm2.Create(Self);
try
lDevice.Publisher := ppReport1.Publisher;
lDevice.FileName := 'test.rtm';
ppReport1.PrintToDevices;
F.ppViewer1.Report := F.ppArchiveReader1;
F.ppArchiveReader1.ArchiveFileName := lDevice.FileName;
F.ppArchiveReader1.PrintToDevices;
F.Show;
finally
lDevice.Free;
end;
I have put a TDBGrid point to the datasource as what the main pipeline
point to. Then i notice when i use native preview, the TDBGrid scroll
once only (traverse dataset once only) but when i use previewer through
TppArchiveDevice the TDBGrid scroll twice (traverse dataset twice). So
as the conclusion i found out the time taken to preview using
TppArchiveDevice is double than the native previewer.
How to have a better performance (as native previewer) when i preview
using TppArchiveDevice and at the same time enjoy the two-pass reports
using the Page-Count in a System Variable.
Regards,
Sherlyn Chew
I have set TppReport.PassSetting = psTwoPass, so i have compared the
performance of two kinds of previewer, one is report builder's native
previewer another is through TppArchiveDevice. Both preview the same
report template with same data. The code shown as below:
Native Preview:
---------------
ppReport1.Print;
Archive Device
--------------
lDevice := TppArchiveDevice.Create(nil);
F := TForm2.Create(Self);
try
lDevice.Publisher := ppReport1.Publisher;
lDevice.FileName := 'test.rtm';
ppReport1.PrintToDevices;
F.ppViewer1.Report := F.ppArchiveReader1;
F.ppArchiveReader1.ArchiveFileName := lDevice.FileName;
F.ppArchiveReader1.PrintToDevices;
F.Show;
finally
lDevice.Free;
end;
I have put a TDBGrid point to the datasource as what the main pipeline
point to. Then i notice when i use native preview, the TDBGrid scroll
once only (traverse dataset once only) but when i use previewer through
TppArchiveDevice the TDBGrid scroll twice (traverse dataset twice). So
as the conclusion i found out the time taken to preview using
TppArchiveDevice is double than the native previewer.
How to have a better performance (as native previewer) when i preview
using TppArchiveDevice and at the same time enjoy the two-pass reports
using the Page-Count in a System Variable.
Regards,
Sherlyn Chew
This discussion has been closed.
Comments
For performance, never connect the Delphi data-aware controls to the same
dataset used for the Report(s). Or if you must share the dataset, then
disconnect the data aware controls prior to generating the report.
TppReport can be used to generate 'live' reports - in which case the
dataset(s) are typically traversed and some type of output is generated.
One type of report output is an archive file. An archive file contains RB
Page objects.
For the Preview example code, keep in mind that only the first page of the
report is being generated. By using the nav buttons of the previewer you can
generate additional pages.
Your second examples generates all pages of a live report to an archive
file. And then as a second step the archive is previewed. So that definitely
requires more work to generate the archive file.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
One suggestion: Not using datasets, but object lists can also improve
speed--then use the TppJITPipeline. Takes a bit more work.
Edward Dressel
Team DM
The problem isn't related to data-aware controls. The TDBGrid shown in
the example is to show how the dataset traverse using both methods
(native previewer and TppArchiveDevice). The question asked is to learn
why TppArchiveDevice traverse the dataset twice but TppPreview only
traverse once for TwoPass report.
Agree. But the second steps in my AQTime profiler doesn't contribute
much (less than 1%) in the overall performance. Again, the question is
to ask why TppArchiveDevice make 2x traversal. The second step should
have nothing to do with the dataset traversing.
From the AQTime profiler result, the performance impact is heavily
related to the 2x dataset traversal.
--
Best regards,
Chau Chee Yang
E Stream Software Sdn Bhd
URL: www.sql.com.my
SQL Financial Accounting
pages nor do they traverse data.
Devices all descend from TppDevice. Preview internally uses ScreenDevice,
which only request one page at a time - based upon what page the user wants
displayed to the screen.
FileDevices such as ArchiveDevice request that all pages be generated by the
report engine and then processes them all creating an output file.
The report engine does not know which type of device(s) are requesting
pages - and in fact multiple devices can be receiving pages at the same
time.
You can optionally set Report.CachePages to true to cause the report engine
to cache pages.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com