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

Any way to speed up initial loading of form

edited August 2001 in General
I have a ppReport with 2 ppDBPipelines and a ppDesigner dropped onto a form.
The report has a Richtext component on it that i link to a file when the
'Show Report' button is clicked, which would make the dynamic creating of
the components difficult, i think ?
The tables are already opened s this is not the delay.
When i create and show the form, it is taking a few seconds (about 3) to
actually show the form.
I have taken both components off and the form loads normally (less than a
second).
Is there a setting i can use so that the report component is only loaded
into memory when an event on the form is fired (on the 'Show Report' button
click' ?
I realise that the delay would come in when the button is pressed, but at
least the initial form would be displayed in the same time as all the
others.
Hope you can help
John

Comments

  • edited August 2001
    Try moving the report to a different form or a datamodule and then only
    creating it when needed ( i.e. you are about to print the report ).
    Alternately you could create the Datamodule that contains the report at the
    start of the program and then when you come into this form it just
    references the already created form.

    Or how about the option to create the form the first time the user opens it
    and then just leave it created so that the next time they come in it doesn't
    need to recreate anything.

    Of course the precreate/precache option will use more memory but your speed
    issues would be solved.

    One other option, that's a lot harder is to spawn a thread at startup that
    creates the forms so that your main thread doesn't block on the form
    creation. Of course this brings with it the issues of synchronizing and
    making sure that the objects that are being created are never used until you
    are absolutely sure that they are through being created.

    just some random thoughts.

    Good luck!

    Michael P. Schneider



    The perception of speed is more important than anything else [grin]
  • edited August 2001
    Thanks for the reply Michael.
    You've given me some very good options there.
    I hadn't even thought about creating the form before it is even required.
    I think i shall probably go with creating it when the application starts.
    Thanks again
    John
  • edited August 2001
    Hi John,

    some days ago I also had to look for speeding up printing the first report.

    I found the following:

    The first printing of a RB report seems to load lot's of Dlls in the
    background (these are windows DLLs for printers, printer configuration and
    what ever Bill Gates does in the background :-) I came to the conclusion,
    that this delay is not direct caused by RB. The deleay is not reasoned by
    instantiating a form with reports on it nor by printing a report.

    So I tried the following solution:

    In one of my forms with reports on it I added an initialization section with
    code to create only one of my reports on that form and directly free it
    again without any displaying or printing.
    ...
    initialization
    with TmyFirstReport.Create() do
    Free;

    That's all!
    Now the delay happens at the start of our application, but nobody worries
    about 1 to 5 seconds more time to initial display the application on the
    screen. With this step I can print my first (really wanted) report at
    runtime without any delay!

    Try it

    Robbi

    P.S. RB Team, if you agree to this explanation I suggest to add something
    similar to the TechTips NG.
  • edited August 2001
    With RB 6.01, we've added a Printer.Initialize method which can be used to
    force the printer driver to load and initialize a device context.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2001
    Thanks very much for that great tip.
    John
This discussion has been closed.