@@ -198,6 +198,9 @@ def __init__(
198198 self ._mentioned_ident_similarity = 0.8
199199
200200 if self .verbose :
201+ self .io .tool_output (
202+ f"RepoMap loaded entries from tags cache: { len (self .TAGS_CACHE )} "
203+ )
201204 self .io .tool_output (
202205 f"RepoMap initialized with map_mul_no_files: { self .map_mul_no_files } "
203206 )
@@ -696,6 +699,8 @@ def get_ranked_tags(
696699 if tag .specific_kind == "import" :
697700 file_imports [rel_fname ].add (tag .name )
698701
702+ self .io .profile ("process files" )
703+
699704 if self .use_enhanced_map and len (file_imports ) > 0 :
700705 import_ast_mode = True
701706
@@ -791,6 +796,8 @@ def get_ranked_tags(
791796 weight = num_refs * use_mul * 2 ** (- 1 * path_distance )
792797 G .add_edge (referencer , definer , weight = weight , key = ident , ident = ident )
793798
799+ self .io .profile ("build graph" )
800+
794801 if not references :
795802 pass
796803
@@ -808,6 +815,8 @@ def get_ranked_tags(
808815 except ZeroDivisionError :
809816 return []
810817
818+ self .io .profile ("pagerank" )
819+
811820 # distribute the rank from each source node, across all of its out edges
812821 ranked_definitions = defaultdict (float )
813822 for src in G .nodes :
@@ -822,6 +831,8 @@ def get_ranked_tags(
822831 ident = data ["ident" ]
823832 ranked_definitions [(dst , ident )] += data ["rank" ]
824833
834+ self .io .profile ("distribute rank" )
835+
825836 ranked_tags = []
826837 ranked_definitions = sorted (
827838 ranked_definitions .items (), reverse = True , key = lambda x : (x [1 ], x [0 ])
@@ -905,9 +916,11 @@ def get_ranked_tags_map(
905916
906917 # Check if the result is in the cache
907918 if use_cache and cache_key in self .map_cache :
919+ self .io .tool_output ("DEBUG: get_ranked_tags_map cache hit" )
908920 return self .map_cache [cache_key ]
909921
910922 # If not in cache or force_refresh is True, generate the map
923+ self .io .tool_output ("DEBUG: get_ranked_tags_map cache miss, generating map" )
911924 start_time = time .time ()
912925 result = self .get_ranked_tags_map_uncached (
913926 chat_fnames , other_fnames , max_map_tokens , mentioned_fnames , mentioned_idents
@@ -929,6 +942,7 @@ def get_ranked_tags_map_uncached(
929942 mentioned_fnames = None ,
930943 mentioned_idents = None ,
931944 ):
945+ self .io .profile ("get_ranked_tags_map_uncached" , start = True )
932946 if not other_fnames :
933947 other_fnames = list ()
934948 if not max_map_tokens :
@@ -943,6 +957,7 @@ def get_ranked_tags_map_uncached(
943957 ranked_tags = self .get_ranked_tags (
944958 chat_fnames , other_fnames , mentioned_fnames , mentioned_idents , True
945959 )
960+ self .io .profile ("get_ranked_tags" )
946961
947962 other_rel_fnames = sorted (set (self .get_rel_fname (fname ) for fname in other_fnames ))
948963 special_fnames = filter_important_files (other_rel_fnames )
@@ -992,6 +1007,7 @@ def get_ranked_tags_map_uncached(
9921007
9931008 middle = int ((lower_bound + upper_bound ) // 2 )
9941009
1010+ self .io .profile ("binary search and to_tree" )
9951011 return best_tree
9961012
9971013 tree_cache = dict ()
0 commit comments