[Home]DeferredCompile/Alternatives

UseModWiki | DeferredCompile | RecentChanges | Preferences

This page considers alternative methods of deferred compilation a priori, that is in advance of actually trying any of them out.

The approach used to defer compilation used in v0.92 is to split the code into three chunks - one that is always compiled, a second that is sometimes compiled ($BrowseCode), and a third that is more rarely compiled ($OtherCode). However by default this feature is commented out, so that all three chunks are always compiled.

Considered options are

  1. leave everything compiled every time
  2. enable deferred compilation of $OtherCode (by decommenting the second assignment to the $OtherCode variable at around line 2442)
  3. additionally allow deferred compilation of $BrowseCode and page cacheing - decommenting second assignment to $BrowseCode (at around line 300) plus setting $UseCache=1 (line 90, or config file)
  4. Rigourously analyse all combinations of sub calls and reduce the program into many more chunks
  5. Use SelfLoader to compile each sub from the same file as the UseModWiki module (effectively one sub in each chunk)
  6. Use AutoSplit/AutoLoader to load each sub individually from separate files (effectively putting each sub chunk in a separate file
  7. Write a home grown version of SelfLoader that is more efficient because it only does exactly what is needed.

Note that option 3 combines the use of cacheing with $BrowseCode - in the absence of cacheing the $BrowseCode will always be needed and there is no advantage in deferring its compilation.

4 differs from 5 and 7 in that option 4 would need a lot of careful analysis, which would have to be repeated following any significant mod. For this reason I will not consider alternative 4 any further.

6 introduces the additional overhead of a file open for each individual sub, with the saving of the equivalent amount of memory for the code of any uncompiled subs. This would only be a good tradeoff where the majority of subs are never called at all, that is for a very different sort of program than the one we have. So alternative 4 will not be pursued further.

Alternative 7 could be quite easy to code automatically (by a global edit on the wiki.pl file) and if so the extra efficiency could be worthwhile.

This leaves us with alternatives 1, 2, 3, 5, 7 to test. Alternatives 5 and 7 could each be tried with and without page cacheing.


SelfLoader uses the __DATA__ section, which cannot be used under mod_perl's Apache::Registry, a popular way of running CGI's -- ChuckAdams


UseModWiki | DeferredCompile | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 6, 2005 3:12 pm by MarkusLude (diff)
Search: