Startup performance markers

Allows us to test startup performance in a real browser or Playwright
This commit is contained in:
Jeremy Ruston 2026-03-15 14:08:42 +00:00
parent b378f3f462
commit 1e06098d20
2 changed files with 10 additions and 0 deletions

View file

@ -14,6 +14,8 @@ var _boot = (function($tw) {
"use strict";
if(typeof performance !== "undefined") { performance.mark("tw-boot-start"); }
// Include bootprefix if we're not given module data
if(!$tw) {
$tw = require("./bootprefix.js").bootprefix();
@ -2585,7 +2587,9 @@ $tw.boot.loadStartup = function(options){
// Load tiddlers
if($tw.boot.tasks.readBrowserTiddlers) {
if(typeof performance !== "undefined") { performance.mark("tw-boot-store-read-start"); }
$tw.loadTiddlersBrowser();
if(typeof performance !== "undefined") { performance.mark("tw-boot-store-read-end"); }
} else {
$tw.loadTiddlersNode();
}
@ -2597,6 +2601,7 @@ $tw.boot.loadStartup = function(options){
$tw.hooks.invokeHook("th-boot-tiddlers-loaded");
};
$tw.boot.execStartup = function(options){
if(typeof performance !== "undefined") { performance.mark("tw-boot-exec-start"); }
// Unpack plugin tiddlers
$tw.wiki.readPluginInfo();
$tw.wiki.registerPluginTiddlers("plugin",$tw.safeMode ? ["$:/core"] : undefined);
@ -2624,6 +2629,7 @@ $tw.boot.execStartup = function(options){
$tw.boot.executedStartupModules = Object.create(null);
$tw.boot.disabledStartupModules = $tw.boot.disabledStartupModules || [];
// Repeatedly execute the next eligible task
if(typeof performance !== "undefined") { performance.mark("tw-boot-startup-modules-start"); }
$tw.boot.executeNextStartupTask(options.callback);
};
/*
@ -2691,6 +2697,7 @@ $tw.boot.executeNextStartupTask = function(callback) {
}
taskIndex++;
}
if(typeof performance !== "undefined") { performance.mark("tw-boot-complete"); }
if(typeof callback === "function") {
callback();
}

View file

@ -14,6 +14,8 @@ See Boot.js for further details of the boot process.
/* eslint-disable @stylistic/indent */
if(typeof performance !== "undefined") { performance.mark("tw-bootprefix-start"); }
var _bootprefix = (function($tw) {
"use strict";
@ -121,6 +123,7 @@ return $tw;
if(typeof(exports) === "undefined") {
// Set up $tw global for the browser
window.$tw = _bootprefix(window.$tw);
if(typeof performance !== "undefined") { performance.mark("tw-bootprefix-end"); }
} else {
// Export functionality as a module
exports.bootprefix = _bootprefix;