@@ -422,12 +422,16 @@ def _get_extension_suppressions(mod_loaders):
422422 self .command_table .clear ()
423423
424424 # Import announced breaking changes in azure.cli.core._breaking_change.py
425+ import time
426+ t1 = time .time ()
425427 import_core_breaking_changes ()
428+ print (f"[PERF] Breaking changes import: { time .time ()- t1 :.3f} s" , file = sys .stderr , flush = True )
426429
427430 command_index = None
428431 # Set fallback=False to turn off command index in case of regression
432+ t1 = time .time ()
429433 use_command_index = self .cli_ctx .config .getboolean ('core' , 'use_command_index' , fallback = True )
430- print (f"[PERF] use_command_index: { use_command_index } , args: { args } " , file = sys .stderr , flush = True )
434+ print (f"[PERF] use_command_index: { use_command_index } , args: { args } , lookup time: { time . time () - t1 :.3f } s " , file = sys .stderr , flush = True )
431435 if use_command_index :
432436 command_index = CommandIndex (self .cli_ctx )
433437 index_result = command_index .get (args )
@@ -495,16 +499,25 @@ def _get_extension_suppressions(mod_loaders):
495499
496500 # No module found from the index. Load all command modules and extensions
497501 logger .debug ("Loading all modules and extensions" )
502+ t1 = time .time ()
503+ print (f"[PERF] Loading ALL modules (no index)" , file = sys .stderr , flush = True )
498504 _update_command_table_from_modules (args )
505+ elapsed_all_modules = time .time () - t1
506+ print (f"[PERF] Loaded ALL modules in { elapsed_all_modules :.3f} seconds" , file = sys .stderr , flush = True )
499507
508+ t1 = time .time ()
500509 ext_suppressions = _get_extension_suppressions (self .loaders )
501510 # We always load extensions even if the appropriate module has been loaded
502511 # as an extension could override the commands already loaded.
503512 _update_command_table_from_extensions (ext_suppressions )
513+ elapsed_all_extensions = time .time () - t1
514+ print (f"[PERF] Loaded ALL extensions in { elapsed_all_extensions :.3f} seconds" , file = sys .stderr , flush = True )
504515 logger .debug ("Loaded %d groups, %d commands." , len (self .command_group_table ), len (self .command_table ))
505516
506517 if use_command_index :
518+ t1 = time .time ()
507519 command_index .update (self .command_table )
520+ print (f"[PERF] Command index update: { time .time ()- t1 :.3f} s" , file = sys .stderr , flush = True )
508521
509522 return self .command_table
510523
0 commit comments