@@ -268,11 +268,13 @@ class PyodideRuntime extends Runtime {
268268The core PyScript app definition.
269269******************************************************************************/
270270const main = function ( ) {
271+ // Used to measure start-up times.
272+ const start = new Date ( ) ;
271273 // Really simple logging. Emoji 🐍 highlights PyScript app logs. ;-)
272274 const logger = function ( ) {
273275 return Function . prototype . bind . call ( console . log , console , "🐍 " , ...arguments ) ;
274276 } ( ) ;
275- logger ( "Starting PyScript. 👋" )
277+ logger ( "Starting PyScript. 👋" , start ) ;
276278
277279 // Default configuration settings for PyScript. These may be overridden by
278280 // the app.loadConfig function.
@@ -309,7 +311,7 @@ const main = function() {
309311 // Flag to indicate the runtime is ready to evaluate scripts.
310312 let runtimeReady = false ;
311313
312- // To hold a reference to the div containing the start-up splash animation
314+ // To hold a reference to the div containing the start-up splash screen
313315 // displayed while PyScript starts up.
314316 let splashElement = null ;
315317
@@ -343,7 +345,6 @@ const main = function() {
343345 splashElement . innerHTML = config . splash ;
344346 const body = document . getElementsByTagName ( 'body' ) [ 0 ] ;
345347 body . appendChild ( splashElement ) ;
346-
347348 } ,
348349 splashOff : function ( ) {
349350 /*
@@ -383,7 +384,8 @@ const main = function() {
383384 const runtimeElement = document . createElement ( "script" ) ;
384385 runtimeElement . src = runtimes [ runtimeName . toLowerCase ( ) ] . url ;
385386 runtimeElement . onload = function ( e ) {
386- logger ( `Runtime "${ runtimeName } " loaded. 👍` )
387+ let duration = new Date ( ) - start ;
388+ logger ( `Runtime "${ runtimeName } " loaded (${ duration } ms). 👍` ) ;
387389 const pyRuntimeLoaded = new CustomEvent ( "py-runtime-loaded" , { detail : runtimeName } ) ;
388390 document . dispatchEvent ( pyRuntimeLoaded ) ;
389391 } ;
@@ -405,7 +407,8 @@ const main = function() {
405407 through each registered plugin's onRuntimeReady method, and begin
406408 evaluating any code in the pendingScripts queue.
407409 */
408- logger ( `Runtime started. 🎬` )
410+ let duration = new Date ( ) - start ;
411+ logger ( `Runtime started (${ duration } ms). 🎬` ) ;
409412 runtimeReady = true ;
410413 plugins . forEach ( function ( plugin ) {
411414 plugin . onRuntimeReady ( config , runtime ) ;
0 commit comments