Extension:Foxway/How it can make MediaWiki faster

How it should work in my understanding. Do not take these examples literally, they show only the principle.

These primitive examples show that a "slow" foxway can make MediaWiki faster, because one can help make efficient use of the cache.

Example 1. There is wiki markup only.
Source of  wiki page :

WELCOME
some text

When saving a page:

 * $title is
 * $pageSource is
 * $parsed['html'] is

When requesting the page:

 * $title is
 * return is

There is no need to cache

Example 2. add php code for foxway
Source of  wiki page :

WELCOME
echo 'Hello!'; some text

When saving a page:

 * $title is
 * $pageSource is
 * $parsed['html'] is
 * $marker is
 * $code is

When requesting the page:

 * $title is
 * $parsed['html'] is
 * $marker is
 * $tmp is
 * return is

Time is spent for foxway: compileTime:     0.00038 secs serialisedTime:  0.00001 secs unserialisedTime: 0.00001 secs runtime:         0.00005 secs

Cache usage
There may be used cache and cache may be smart. One can decide whether to caching based on attendance and runtime foxway.

When saving a page:

When requesting the page:

Example 3. Include page
Source of  wiki page: This is MediaWiki version echo CURRENTVERSION;

When saving a page:

 * $title is
 * $pageSource is
 * $parsed['html'] is
 * $marker is  and
 * $code is  and

When requesting the page:
 * $title is
 * $parsed['html'] is
 * $marker is  and
 * $tmp is  and
 * return is

About cache useage
Actually cache can be much smarter. In addition, scripts can be able to give hints to the cache manager or manage the cache.
 * If in the included page there are not scripts, then just return parsed data for all.
 * If in the included page there are parameters, need save and return data in the context of the used parameters for all.
 * If in the included page there are scripts, you can check: are there global or static variables or any dynamic data?

All this can help make efficient use of the cache.

Using single query to external data sources (Wikidata for example)
Suppose, on the page there is a lot of data downloaded from Wikidata. If I am right, all they are does sequentially, and each new request cannot be executed until the old was not finished. Foxway can transparently aggregate these requests into one.

Source of  page:

Source of  page: MW::ShowFromWikidata( $_arg[1] );