@@ -165,15 +165,21 @@ class Timings:
165165 """Manages and analyzes execution timing statistics for Advent of Code solutions."""
166166
167167 def __init__ (self , db : sqlite3 .Connection ):
168+ self .db = db
169+ self ._last_load = 0
170+ self .load ()
171+
172+ def load (self ):
173+ self ._last_load += 1 # to refresh the lru_cache
168174 self .year_begin = min (aoc_available_years ())
169175 self .year_end = max (aoc_available_years ())
170176
171177 self .user_inputs = defaultdict (set )
172- for user , _year , _day , crc in db .execute ("select user,year,day,crc from inputs" ):
178+ for user , _year , _day , crc in self . db .execute ("select user,year,day,crc from inputs" ):
173179 self .user_inputs [crc ].add (user )
174180
175181 self .solutions = defaultdict (lambda : defaultdict (dict ))
176- for year , day , crc , prog , lang , elapsed , status in db .execute (
182+ for year , day , crc , prog , lang , elapsed , status in self . db .execute (
177183 "select year,day,crc,prog,lang,elapsed,status from solutions"
178184 ):
179185 # if answers are ok and not an alternative solution
@@ -190,7 +196,7 @@ def get_languages(self) -> set[str]:
190196 return set (lang for sol in self .solutions .values () for lang in sol )
191197
192198 @lru_cache (maxsize = None )
193- def get_stats (self , user : str , lang : str , tablefmt : str ) -> Stats :
199+ def get_stats (self , user : str , lang : str , tablefmt : str , _last_load : int ) -> Stats :
194200 """
195201 Compute and return execution timing statistics for a given user and language.
196202
@@ -247,7 +253,7 @@ def get_stats(self, user: str, lang: str, tablefmt: str) -> Stats:
247253
248254 def print_stats (self , user : str , lang : str , tablefmt : str = "rounded_outline" ):
249255 """Print timing statistics in a formatted table with performance breakdown."""
250- stats = self .get_stats (user , lang , tablefmt )
256+ stats = self .get_stats (user , lang , tablefmt , self . _last_load )
251257
252258 print (tabulate .tabulate (stats .data , stats .headers , tablefmt , floatfmt = ".3f" ))
253259
@@ -334,11 +340,11 @@ def main():
334340 languages = (
335341 "Rust" ,
336342 "Python" ,
337- "Py3.10" ,
343+ # "Py3.10",
338344 "Py3.11" ,
339- "Py3.12" ,
340- "Py3.13" ,
341- "Py3.13t" ,
345+ # "Py3.12",
346+ # "Py3.13",
347+ # "Py3.13t",
342348 "Py3.14" ,
343349 "Py3.14t" ,
344350 "Go" ,
@@ -377,6 +383,10 @@ def main():
377383 elif e == "KEY_DOWN" :
378384 if current_language < len (languages ) - 1 :
379385 current_language = (current_language + 1 ) % len (languages )
386+
387+ elif e in ("r" , "R" , " " ):
388+ print ("reload" )
389+ timings .load ()
380390 else :
381391 print (f"unknown event: { repr (e )} " )
382392 continue
0 commit comments