Extremely slow report when generated with more than 500 thousand records

Hello friends.
I have a serious performance problem in my application due to fastreport, I use the same to generate extremely large reports, where it is created from a TObjectList with the help of the frxUserDataSet component.
But when the list comes with more than 500,000 records, the ".preparereport" is very slow, taking more than 20 minutes to generate the report. I have tried several things to try to optimize but without success.
I would like some help from you to solve this problem.
I am attaching in the topic an example of how I use fastreport with the Delphi Seattle.

thanks in advance.

Comments

  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited 7:43PM
    I know I had issues with seemingly exponential runtime a few years ago, and it seemed to be related to traversing linked lists in FR.
    Doing it a different way was suggested by FR, but I'll have to search for the notes. I don't think it's the same as your problem, though.
    1) I don't know enough about object lists to know how they are indexed, but creating an array of pointers to the objects may speed up data retrieval
    2) Doing 10 reports of 5000 lines and concatenating the results in one preview may help, I'm sure that has been mentioned on the forum
  • gpigpi
    edited 7:43PM
    This code
    else if (CampoValido(sVarName)) then
    Value := '0';
    
    returns string, for "VALOR_TOTAL", "VALOR_PRESTACAO" and others which are using in aggregates.
    FastReport uses variant types for aggregates , that means SUM function works even for string values and it concatenates string values 500 thousand times.
    Use
    else if (CampoValido(sVarName)) then
    Value := 0;
    
    to return number values for fields used in agregate functions for all these aggregates :
    [SUM(<VALOR_TOTAL>, MasterData, 1)]
    [SUM(<VALOR_PRESTACAO>, MasterData, 1)]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.