Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Performance Enhancements

edited September 2010 in General
Hi there,

we're migrating from RB 5.55 to 11.06. I already checked the Source of
12.01 and it seems to be the same as in 11.06.

We noticed severe performance loss in the new version. We generated
several reports, where execution time in 11.06 was around 3 times higher
than in the early version 5.55. After some profiling we found out that
TppTextMarkups.EOP and TppTextMarkups.CRLF are hit very often (in our
examples EOP was called more than 9 mio times, much more often than any
other routine).

As we had a look at this, we found that TppTextMarkups consists of class
functions only, which, when called often enough, are a huge loss of
performance. We just redefined the two most called functions (EOP and
CRLF) as constants to see the difference and the generation time
decreased from 3 times slower to 1.5 times slower than 5.55...

Source changes:
from
class function EOP: String;
to
const EOP = String(#36#182);

This small change from class functions to constants already enhanced the
execution time immense.

As performance is very important for us, 'cause some of our customers
have very huge reports, we think spending some time in enhancing
performance wouldn't be bad at all. Consider, those small changes show
already a big boost, there would be much more to fetch.

Cheers,
Nico

Comments

  • edited September 2010

    To optimize long reports, try setting Report.OutlineSettings.Enabled to
    False.

    Thanks for the feedback, I will put your suggestion on the list. There are
    enhancements we have made over the years to optimize performance in several
    places and we continue to look for opportunities to add more.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2010
    The problem is also the number of times rb11/12 run the query, it does 3
    times .

    In RB5 and RB7 made him only 2 times.

    Edgar Britez



  • edited September 2010

    In my testing here I did not find this to be true. I asked you for a test
    case. You sent to support a 'video' instead. So I created a test case myself
    and I replied to you.

    Here is a copy of the email reply I sent to you....

    In your video you do not show whether Active is being set to true or false.
    Sometimes the query is being closed. You also do not show the call stack, so
    I cannot determine whether the query is being opened or closed.

    I created a simple test using RB 12.02. I am using the sample Employee
    Interbase database included with Delphi. I created a simple query on the
    Customer table. Here is my event-handler - see code below.

    When I run the example, the query fires once to get the field info. And it
    fires a second time to run the report. If I close the preview window and
    press my Print button a second time and enter a new search value, the query
    only fires once (but SetActive is called once to close the query and once to
    open the query).

    procedure TForm1.ppReport1InitializeParameters(Sender: TObject; var aCancel:
    Boolean);
    var
    lsValue: String;
    lSQLBuilder: TdaSQLBuilder;
    begin
    InputQuery('Enter CustNo', 'CustNo', lsValue);

    lSQLBuilder := TdaSQLBuilder.Create(ppReport1.DataPipeline);

    if not lSQLBuilder.SearchCriteria.Exists('Customer', 'Cust_No') then
    lSQLBuilder.SearchCriteria.Add('Customer', 'Cust_No', '=', lsValue)
    else
    lSQLBuilder.SearchCriteria[0].Value := lsValue;


    lSQLBuilder.ApplyUpdates;
    lSQLBuilder.Free;

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2010
    Excuse the delay, today I will be sending demos

  • edited October 2010
    On 23.09.2010 16:06, Edgar Britez wrote:

    What about this now?! I'm interested in your conclusion. Is the query
    run 2 or 3 times in RB11/12? Cannot imagine why the query should be run
    3 times...

    Skål.
  • edited November 2010
    2 times.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.