Uploaded image for project: 'XWiki Rendering'
  1. XWiki Rendering
  2. XRENDERING-642

Improve the macro transformation not to rescan the whole XDOM for each macro

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • None
    • 13.10.2
    • Macro
    • Unknown

    Description

      The macro transformation currently scans the whole XDOM after each macro execution. This is because macro executions can modify the XDOM in arbitrary ways and in particular also introduce new macros as the child of any block. The foonote macro does this, for example.

      We could let the XDOM report if it got modified (which sounds quite difficult to do reliably, though, as we would need to detect changes to the list of children of every block) or let macros declare if they could (possibly) modify the XDOM (which means every macro would need to declare this).

      If we know that only children of the current macro need to be scanned for new macros, a priority queue could be used to get the macro with the highest priority. This priority queue could be updated with new children and would only need to be rebuilt if an "unsafe" macro is executed/a macro modified the XDOM.

      Note that 1000 macros need around 7ms as of XWiki 12.10.11, see here though note that the bad results on 13.10.2 were a performance regression due to XWIKI-19314 that should be fixed. A benchmark while debugging this regression showed that the traversal of the XDOM in the macro transformation is the main part of that running time.

      Attachments

        Activity

          People

            Unassigned Unassigned
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: