Slow export to pdf in the first time

Posted by: ilia on 27 March 2018, 6:02 pm EST

  • Posted 27 March 2018, 6:02 pm EST

    I use the last version of AR 2.0 for export my small report to pdf , I set DeviceName = "".
    The export to pdf takes 0.6 seconds in the first time, in second time it takes 0.03 sec.
    In another same computer it takes 0.03 sec in the first time. How to speed up in
    the first time in my "slow" computer?
    I tested AR 12, it takes 0.9 sec in the first time in both computers and 0.06 in the second time.
  • Replied 27 March 2018, 10:30 pm EST

    Hello,

    Could you please provide the stripped down application to replicate the issue at our end.

    Thanks,
    Mohit
  • Replied 28 March 2018, 12:04 am EST

    Attached ExportToPdf.exe
    ExportToPdf.zip
  • Replied 28 March 2018, 12:13 am EST

    Attached ExportToPdf.exe with two reports.
    ExportToPdf.zip
  • Replied 28 March 2018, 7:56 pm EST

    Hello ilia,

    The .net applications load the referenced assemblies when it is needed. Therefore, the first call of export takes more time.

    You can use NGEN tool which may resolve your issue.
    https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator

    Hope it clarifies.

    Thanks,
    Mohit
  • Replied 28 March 2018, 9:53 pm EST

    First, I asked about AR2.COM application.
    Second, In AR12 .net application loading GrapeCity.ActiveReports.Export.Pdf.v12.dll takes 0.000 sec. on my "slow" computer.
  • Replied 2 April 2018, 4:15 pm EST

    AR2.COM is a legacy product and hasn't been in development for a long time now. Unfortunately, we don't support it anymore and would request you to upgrade to the latest version i.e AR12. There have been many improvements in ActiveReports over the years and exporting is one of them.
  • Replied 1 April 2018, 11:26 pm EST

    Why AR12 works slowly in the first export to pdf (0.9 sec)?
  • Replied 2 April 2018, 4:00 pm EST

    AR12 works slowly the first time because of the reason Mohit had mentioned earlier.

    mohitg said:
    Hello ilia,

    The .net applications load the referenced assemblies when it is needed. Therefore, the first call of export takes more time.

    You can use NGEN tool which may resolve your issue.
    https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator

    Hope it clarifies.

    Thanks,
    Mohit
  • Replied 3 April 2018, 8:17 pm EST

    Loading of GrapeCity.ActiveReports.Export.Pdf.v12.dll takes 0.000 sec. on my computer.
    AR12 works slowly in the first export to pdf. It takes 0.9 seconds and 0.7 after the assembly GrapeCity.ActiveReports.Export.Pdf... was loaded.

    My Test:

    DefaultPrinter - (Brother HL-L2360D series Printer)

    First Export to PDF.

    rpt.Document.Printer.PrinterName - ()
    rpt.Run - 0.21071 seconds
    PdfExport1.NeverEmbedFonts = " - 0.03709 seconds
    PdfExport1.Export - 0.7339 seconds

    Second Export to PDF.

    rpt.Document.Printer.PrinterName - ()
    rpt.Run - 0.00300 seconds
    PdfExport1.NeverEmbedFonts = " - 0.00501 seconds
    PdfExport1.Export - 0.0381 seconds
  • Marked as Answer

    Replied 4 April 2018, 4:31 pm EST

    Hello Ilia,

    It is the JIT (Just In Time compilation) that lets you wait the first time you run your .net apps. This compiles your IL to machine code before running the code. The reason this happens only the first time is that the machine code version is then stored on disk an reused.

    As I said earlier, you can use "Ngen.exe" to pre-jit your application. Also, this needs to be done on the computer you run the software on, since the JIT will compile and optimize for the CPU it is running on. You could do this as a part of the installation of your program.

    Also, please refer the video on the following link:
    https://www.dropbox.com/s/w2bkt6kczrx3gz4/vid_Ngen.zip?dl=0

    Hope it clarifies.

    Thanks,
    Mohit
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels