Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-24328

The anchor refactoring performed by PDF export is very inneficient

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.4.0-rc-1, 17.10.9
    • 18.3.0, 17.10.8
    • Export - PDF
    • None
    • Unknown

    Description

      In order to debug a timeout of a very large PDF export (3k print pages) I added some logs to see the time spend by PDF export on each step, client side. This showed that a significant amount of time was spent refactoring the anchors (links) before generating the print layout:

      PageReady: 46263.615966796875 ms
      protectAgainstMissingStyleSheets: 2.33203125 ms
      refactorAnchors: 146766.5751953125 ms <------------ 2m30s 
      removeEmptyTableOfContents: 0.8701171875 ms
      validateTableOfContentsAnchors: 322.55517578125 ms
      storeFormFieldValues: 170.8349609375 ms
      makeTableCellWidthRelative: 295.844970703125 ms
      preserveWhiteSpaceInCodeBlocks: 255.382080078125 ms
      preventLazyImageLoading: 12.23095703125 ms
      replaceCanvasesWithImages: 11.02587890625 ms
      PrintLayout: 3058505.505859375 ms
      PrintPreview: 3253575.2138671875 ms (54 min)
      

      This made me check the code. It is indeed quite inefficient. For such a large PDF export you have thousands of anchors (links) so it's important to process them in an optimal way.

      Attachments

        Activity

          People

            mflorea Marius Dumitru Florea
            mflorea Marius Dumitru Florea
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: