dkprojektai 1 Posted July 19, 2020 Hello, Does any body face with problem - generating pdf speed... I use Fast Report: frxReport9.PrepareReport(); frxPDFExport9.ShowDialog := False; frxPDFExport9.FileName := FormatDateTime('hhnnss', Time)+'_Report.pdf'; frxReport9.Export(frxPDFExport9); this code works extremely slow with more then 5000 dateset records. Is there any speedy alternative? Share this post Link to post
Bill Meyer 337 Posted July 19, 2020 5 hours ago, dkprojektai said: Hello, Does any body face with problem - generating pdf speed... I use Fast Report: frxReport9.PrepareReport(); frxPDFExport9.ShowDialog := False; frxPDFExport9.FileName := FormatDateTime('hhnnss', Time)+'_Report.pdf'; frxReport9.Export(frxPDFExport9); this code works extremely slow with more then 5000 dateset records. Is there any speedy alternative? That code is not much help in understanding the speed issue. What is the data source for your report? Is it the actual report generation which takes time, or the data preparation? In other words, what is happening in PrepareReport? And what do you mean by "extremely slow?" How many pages are produced, and in what time period? I work routinely in ReportBuilder, and these are the issues I would look at. One more: If you produce in your report a line saying page x of y, I would guess that FastReport will generate the report twice. Certainly that is how ReportBuilder does it. Apart from these issues, I found a few years ago that there can be huge performance differences among the different in-memory datasets, so I wonder whether that may be a factor for you. Share this post Link to post
Cristian Peța 103 Posted July 20, 2020 (edited) Take a profiler and save you time guessing what is slow. I use Nexus Quality Suite and I like it but there are also some free alternatives. Actually first time I used it I found the bottleneck with the trial version of NQS. I like very much line profiler. If you try it for these 4 lines it is very probably the first line and not the last that is the bottleneck. Then you goo deeper. P.S. If the time is big enough you can see also in debugging if the first or last line is slower. If the last line is slow then not the dataset is bottleneck but maybe some very big picture. Edited July 20, 2020 by Cristian Peța Share this post Link to post
dkprojektai 1 Posted July 20, 2020 Thank you all, what I found - disable all to False (for frxPDFExport9). It helps a little. There is picture (8 KB), but I think, it's not this who gives low speed for building PDF. For me 5000 records was build thru 15 seconds. It's too much for me. I use 6.6.9 version and D10.3. Any other thoughts ? Share this post Link to post
Bill Meyer 337 Posted July 20, 2020 22 minutes ago, dkprojektai said: Thank you all, what I found - disable all to False (for frxPDFExport9). It helps a little. There is picture (8 KB), but I think, it's not this who gives low speed for building PDF. For me 5000 records was build thru 15 seconds. It's too much for me. I use 6.6.9 version and D10.3. Again, with no knowledge of content, it is impossible to speculate. If one row per record, you are talking about roughly 60 pages, and though we always want things to be fast, 15 seconds for 60 pages doesn't sound terrible. You need to do some profiling. Also isolate the timing of the report production from any data preparation. Lacking any detailed knowledge of your code, we can offer no specifics. Share this post Link to post
Cristian Peța 103 Posted July 20, 2020 3 hours ago, dkprojektai said: low speed for building PDF Building PDF is PrepareReport() or Export() ? Share this post Link to post
dkprojektai 1 Posted July 20, 2020 10 minutes ago, Cristian Peța said: Building PDF is PrepareReport() or Export() ? Export Share this post Link to post
Cristian Peța 103 Posted July 20, 2020 (edited) At Export() that 5000 records doesn't count because the report is prepared. How many pages are? How many items per page? There are also vector images like charts or EMF, WMF? I tested for example 40 pages (200 records with one image and 30 text items per record) with booth FR Export and printing to "Microsoft print to PDF". The speed is about 3 seconds for both on a i7-8700K CPU. This is only Export because I do this at preview where the report is already prepared. P.S. You are too scarce with details and want a suggestion..... Edited July 20, 2020 by Cristian Peța 1 Share this post Link to post
Vandrovnik 214 Posted July 21, 2020 14 hours ago, dkprojektai said: There is picture (8 KB), but I think, it's not this who gives low speed for building PDF. Just to be sure, have you tried without the picture? Is there 1 picture for the report, or 1 picture for each record? Share this post Link to post
Lars Fosdal 1792 Posted July 21, 2020 What about the queries that provide the data to the report - are they fast if they are run stand alone? Share this post Link to post
dkprojektai 1 Posted July 21, 2020 This is how looks 1 page. 5000 records generates 200 pages. Share this post Link to post
dkprojektai 1 Posted July 21, 2020 11 hours ago, Lars Fosdal said: What about the queries that provide the data to the report - are they fast if they are run stand alone? /* Affected rows: 0 Found rows: 4 956 Warnings: 0 Duration for 1 query: 1,109 sec. (+ 0,032 sec. network) */ Share this post Link to post
Cristian Peța 103 Posted July 21, 2020 Have you tried with Microsoft driver? frxReport9.PrintOptions.PrnOutFileName := 'name.pdf'; frxReport9.PrintOptions.Copies := 1; frxReport9.PrintOptions.ShowDialog := False; frxReport9.PrintOptions.Printer := 'Microsoft Print to PDF'; frxReport9.SelectPrinter; frxReport9.Print; Share this post Link to post
dkprojektai 1 Posted July 21, 2020 8 minutes ago, Cristian Peța said: Have you tried with Microsoft driver? frxReport9.PrintOptions.PrnOutFileName := 'name.pdf'; frxReport9.PrintOptions.Copies := 1; frxReport9.PrintOptions.ShowDialog := False; frxReport9.PrintOptions.Printer := 'Microsoft Print to PDF'; frxReport9.SelectPrinter; frxReport9.Print; I can't use it, because all works on Unigui web server. Share this post Link to post
Cristian Peța 103 Posted July 21, 2020 Only for testing. Why not? It's not Windows 10? Share this post Link to post
Cristian Peța 103 Posted July 21, 2020 The best would be to profile frxExportPDF unit Share this post Link to post
Cristian Peța 103 Posted July 21, 2020 Just tried 200 pages of something like this. 13 seconds. Share this post Link to post
Cristian Peța 103 Posted July 21, 2020 (edited) This procedure takes 76% of time in my case 2694 procedure TfrxPDFExport.ExportViaVector(const Memo: TfrxCustomMemoView); and was called because GapY was -1 if (Memo.ReducedAngle <> 0) or (Min(Memo.GapX, Memo.GapY) < 0) then ExportViaVector(Memo) With Gap=0 for some of memo components ExportViaVector() takes 44% of time and the report looks the same but the PDF is generated in 6 seconds vs. 13 seconds Edit: Better take a profiler and don't lose the time guessing. Edited July 21, 2020 by Cristian Peța 2 Share this post Link to post