Performance Issue with Crystal Reports

I'm having a crystal reports performance issue within my VB 2005 Windows application I'm hoping someone can assist with. When I open a report after initial application startup, my hard drive spins like crazy and it takes approximately 20-25 seconds to display the report. Subsequent reports are very snappy and display almost immediately.

I'm guessing the initial delay is related to components in the crystal reports engine being initialized. If this is the case, is there a way to initialize during application startup Anybody else experience the same issue By the way, the application was developed using VS2005 Professional Edition (in Visual Basic) and uses SQL Server 2005 Express Edition for the backend database.

Thanks in advance for the help,

Tony




Answer this question

Performance Issue with Crystal Reports

  • A Wilco

    So far no responses, so I thought I'd move the thread back to the top. ANY help would be greatly appreciated!!

  • yln

    April,

    Thanks a lot for running that down! Looks like I'll have to work on that workaround. Down you happen to have a link to the White Paper they're talking about

    Tony



  • flipdoubt

    Are you using the crystal reports came with VS2005
    I also have performance issue, it is extremely slow compared with crystal reports XI, especially in looping the object and setting logon info. Try to use XI with .net if you have its license.

  • Christian Kaelin

    Thanks for the follow up. Our App is being QA'd right now, and although we have implemented the work-around I'm still not crazy about the idea, and the pre-loaded components still take 3-5 seconds to load, which is significantly slower than the rest of the app. I will try your suggestion on the next revision, as it is out of my hands right now, and post back my results.

    Thanks!


  • BitBasher

    Thanks for the reply Barry. I am using the version of Crystal Reports that is integrated into VS2005 Pro edition. Are you happy with CR XI R2 Are you having any issues using R2 with VS2005 I know R2 is supposed to support VS 2005, but I'd like to hear it from the people that actually use it...

    Tony



  • Kiefer

    The best solution that i tested and implemented was to load a report at application startup....Just load..no need to preview or export.....

    Its a good pratice to use a separate thread for this initial load so as not to increase the application start up time..

    All report calls to in the application including the first one are realtively quicker after this...:-)


  • Andrew Timberlake-Newell

    Any luck with this I am currently trying to resolve the very same issue.
  • THNH

    Expanding on April's comment, here's something I've tried that seems to work very well.  I have a data entry form with a print preview button.  When the user clicks the button it opens up another form that holds the Crystal Report viewer.   The trick is to use a BackgroundWorker component and let it do the loading for you.  Here some sample code:

    Public Class MainForm

    Private viewer As New MyViewer

    ' This variable will be used in the print button

    ' Click event and in the background worker RunWorkerCompleted

    ' event.  It will let the background worker know if the

    ' print button was clicked while it was loading Crystal.

    Private printRequested As Boolean = False

     

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Me.BackgroundWorker1.WorkerSupportsCancellation = True

    ' Start worker. 

    Me.BackgroundWorker1.RunWorkerAsync(printRequested)

    End Sub

     

    Private Sub PrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreview.Click

    If Not BackgroundWorker1.IsBusy Then

    viewer.ShowDialog()

    Else

    printRequested = True

    End If

    End Sub

     

    Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

    ' Cancel worker before closing

    If BackgroundWorker1.IsBusy Then BackgroundWorker1.CancelAsync()

    End Sub

     

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

    Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)

    e.Result = LoadCrystalReports(CBool(e.Argument), worker, e)

    End Sub

    Private Function LoadCrystalReports(ByVal showViewer As Boolean, ByVal worker As BackgroundWorker, ByVal e As DoWorkEventArgs) As Boolean

    If worker.CancellationPending Then

    e.Cancel = True

    Else

    Dim report As New MyReport

    viewer.CrystalReportViewer1.ReportSource = report

    report.SetDataSource(Me.BindingSource1)

    viewer.CrystalReportViewer1.Zoom(1) 'Page width

    End If

    Return showViewer

    End Function

     

    Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted

    If Not (e.Error Is Nothing) Then

    MessageBox.Show(e.Error.Message)

    ElseIf e.Cancelled Then

    ' Next, handle the case where the user canceled the

    ' operation.

    ' Note that due to a race condition in

    ' the DoWork event handler, the Cancelled

    ' flag may not have been set, even though

    ' CancelAsync was called.

    ElseIf e.Result = True OrElse printRequested = True Then

    ' Finally, handle the case where the operation succeeded.

    ' If the print button was clicked then display viewer.

    viewer.ShowDialog()

    End If

    End Sub

    End Class


  • Manu_Raj

    I think the best work around is to load a sample report at application startup in a seperate thread (so that the application startup time remains the roughly the same)....Just load, no viewing or exporting.....

    All calls in in the applcation for the report will be much faster...


  • Melody Zhao

    Well well well....I entered a support case with Business Objects, they are quite good about getting back to you on those. Unfortunately the response was less than satisfying....looks like a kludgy workaround is our only solution.....here is what they said....

    This is an expected behavior. On initial start up, a number of Crystal assemblies and objects need to be created and this does take some time. As a BTW., once you run the 1st report, you could close the app and restart it and the performance should be much quicker. Only actual computer re-boot will once again result in initial slow load. I do not have any was of "pre-loading" the assemblies and objects, however I id suggest the following to one of my customers:

    On start of the application, load a report and programatically export it to some temp directory (any format will do) - no viewer needed, just a simple export that nobody will see. As this happens on load of the app exe, the load time is now at start of the app as opposed to first run of a report. Once the user actually needs to run the report, all the assemblies, etc. are loaded and there will be no delay. The export code is described in this White Paper on page 192+


  • Greg P.

    I am using CR XI Release 2 and having the same issues as you are. Up to a minute for initial load (not just after application start but after an hour /day or so - client having the problem). Once it has loaded, reloads are very quick, even with loads of data.

    Apart from the initial report load delay I'm very happy with XI developer, developing a report with Crystal's developer application is much better than in the IDE - it makes lining up controls much easier for one thing.

    If anyone finds something to fix this I'd be very interested

    Shane


  • Melsom

    April,

    No, I haven't had any luck yet. I was hoping for a reply from someone from Crystal telling us what the problem is and maybe how to fix it. It seems like many are having the same issue. Now that the thread is back on top, maybe we'll get a response.

    Tony



  • Performance Issue with Crystal Reports