Tags:
archive_me1Add my vote for this tag create new tag
, view all tags

Implemented: New beforeCommonTagsHandler and afterCommonTagsHandler Plugin Callbacks

There is already a CommonTagsHandler callback, which is used by Plugins to expand Plugin specific %VARIABLES%. The TWiki::handleCommonTags function is expanding preferences variables and internal variables before calling the Plugin callback handler.

Rendering topics that have lots of dynamic content can be slow. It is especially slow for nested FormattedSearch. A Plugin that caches topic text with the variables expanded can speed up the page rendering considerably, at the cost of not showing up-to-date content.

Unfortunately it is not possible to use the existing commonTagsHandler callback since preferences variables and internal variables are already expanded. For this, new beforeCommonTagsHandler and afterCommonTagsHandler are needed that gets called at the beginning and at the end of the TWiki::handleCommonTags.

Sequence of variable expansion

Internally, TWiki::handleCommonTags expands all variables in the following sequence:

  • call beforeCommonTagsHandler of all Plugins ( new )
  • take out verbatim tags
  • handle all preferences variables
  • handle all internal variables (%WEB%, %SEARCH{}% etc)
  • handle %INCLUDE{}%; for each include:
    • take out verbatim tags
    • handle all preferences variables
    • handle all internal variables (%WEB% etc)
    • call commonTagsHandler of all Plugins
    • handle all preferences variables (again because of Plugins)
    • handle all internal variables (again because of Plugins)
    • recursive call to handle %INCLUDE{}%
  • call commonTagsHandler of all Plugins
  • handle all preferences variables (again because of Plugins)
  • handle all internal variables (again because of Plugins)
  • handle %TOC{}%
  • put back verbatim tags
  • call afterCommonTagsHandler of all Plugins ( new )

Contributors:
-- PeterThoeny, ThomasWeigert - 13 Jul 2004

Discussions

Related, StepByStepRenderingOrder is documenting the rendering sequence but it is not yet accurate.

-- PeterThoeny - 13 Jul 2004

While this is off-topic, the above sequence (I modified the wording to make clear where the recursive call for handling %INCLUDE{}% is) made me wonder: why is %INCLUDE{}% handled in the middle at the outer level, but then at the tail of each recursive call to TWiki::handleIncludeFile?

-- ThomasWeigert - 14 Jul 2004

Reason: The topic name to INCLUDE may contain preferences and/or internal variables like %INCLUDE{"%TOPIC%SideBar"}%. The INCLUDEd text may contain preferences and/or internal variables like %TOPIC% and %INCLUDINGTOPIC% that need to be resolved correctly before the Plugins hook is called. The Plugins might introduce new variables that need to be resolved before recursion (the included text could contain %INCLUDE{"%TOPIC%SideBar"}%)

-- PeterThoeny - 15 Jul 2004

This enhancement is now in SVN.

FYI, I had a disk space issue that resulted in a failed notify. The issue is resolved, but twiki-dev did not get the change log. 1 * diffs.txt: Diffs (for reference, not for patch)

-- PeterThoeny - 15 Jul 2004

Benchmark tests (msec)

Topic Before After change Drop
TWiki.WelcomeGuest 493 496 0.6%
TWiki.WikiWord 488 489 0.1%
Search with 300 topics 1343 1346 0.2%

-- PeterThoeny - 16 Jul 2004

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt diffs.txt r1 manage 12.2 K 2004-07-15 - 09:51 PeterThoeny Diffs (for reference, not for patch)
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2008-08-25 - TWikiJanitor
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.