mediawiki-extensions-Scribunto/includes/engines/LuaCommon
Ori Livneh 47f0194c2a Avoid calling into PHP from Lua to check if 'current' or 'empty' frames exist
On the Wikimedia cluster, 1.6% of MediaWiki wall-clock time is burnt on
calls from Lua into Scribunto_LuaSandboxCallback::frameExists()[1]. We
can optimize away many of these calls by not calling into PHP to check
if 'empty' or 'current' exist: the engine always reports that the
'empty' frame exists, and 'current' is guaranteed to have been set up
(in LuaEngine::setupCurrentFrames) prior to calling into Lua.

To help validate this, I added debug logging to the current production
branch of Scribunto[2] to see if there are any cases where
Scribunto_LuaSandboxCallback::frameExists('current') is false. As I
write this commit message, the logging code has been active for 24H and
there have not been any occurrences.

  [1]: https://performance.wikimedia.org/arclamp/svgs/daily/2021-03-16.excimer-wall.all.reversed.svgz
  [2]: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Scribunto/+/672836

Change-Id: I1902b711c9a442a5a42745a582a6a9ff988a355f
2021-03-17 18:04:09 -07:00
..
lualib Avoid calling into PHP from Lua to check if 'current' or 'empty' frames exist 2021-03-17 18:04:09 -07:00
HashLibrary.php Add method scope visibility 2018-11-19 21:18:12 +00:00
HtmlLibrary.php Add method scope visibility 2018-11-19 21:18:12 +00:00
LanguageLibrary.php Avoid using User::getDefaultOption 2021-03-01 13:19:04 +02:00
LibraryBase.php Add method scope visibility 2018-11-19 21:18:12 +00:00
LuaEngine.php Add missing @var and improve documentation 2020-12-22 01:15:00 +00:00
LuaError.php Add missing @var and improve documentation 2020-12-22 01:15:00 +00:00
LuaInterpreter.php Add missing @var and improve documentation 2020-12-22 01:15:00 +00:00
LuaInterpreterBadVersionError.php Split all classes in own files 2019-12-21 10:20:18 +01:00
LuaInterpreterNotFoundError.php Split all classes in own files 2019-12-21 10:20:18 +01:00
LuaModule.php build: Updating dependencies 2020-04-22 19:07:11 +00:00
MessageLibrary.php Use MediaWikiServices::getContentLanguage() 2020-03-16 17:58:26 +00:00
SiteLibrary.php Add missing @var and improve documentation 2020-12-22 01:15:00 +00:00
TextLibrary.php Replace use of Parser::$mStripState, deprecated in 1.35 2021-02-25 03:03:29 +00:00
TitleLibrary.php Add missing @var and improve documentation 2020-12-22 01:15:00 +00:00
UriLibrary.php Use strict equality when comparing namespaces 2021-01-01 16:44:40 +00:00
UstringLibrary.php build: Updating mediawiki/mediawiki-phan-config to 0.10.6 2020-12-30 14:30:00 +00:00