diff --git a/performance.md b/performance.md index 25faf53..78efb82 100644 --- a/performance.md +++ b/performance.md @@ -1,9 +1,9 @@ # VFBquery Performance Test Results -**Test Date:** 2025-10-21 03:01:50 UTC -**Git Commit:** 0b907afb912bf74823942a33ffb91ef50531c457 -**Branch:** main -**Workflow Run:** 18671440241 +**Test Date:** 2025-10-21 16:36:49 UTC +**Git Commit:** 3c071f3202c2997ad95c1314c2a14762f2b05464 +**Branch:** dev +**Workflow Run:** 18690968894 ## Test Overview @@ -25,11 +25,11 @@ This performance test measures the execution time of VFB term info queries for s ✅ **Test Status**: Performance test completed -- **FBbt_00003748 Query Time**: 1.4273 seconds -- **VFB_00101567 Query Time**: 1.3915 seconds -- **Total Query Time**: 2.8188 seconds +- **FBbt_00003748 Query Time**: 1.5294 seconds +- **VFB_00101567 Query Time**: 1.2568 seconds +- **Total Query Time**: 2.7862 seconds 🎉 **Result**: All performance thresholds met! --- -*Last updated: 2025-10-21 03:01:50 UTC* +*Last updated: 2025-10-21 16:36:49 UTC* diff --git a/src/vfbquery/vfb_queries.py b/src/vfbquery/vfb_queries.py index 85a8f84..4c4b5c3 100644 --- a/src/vfbquery/vfb_queries.py +++ b/src/vfbquery/vfb_queries.py @@ -59,6 +59,23 @@ def get_dict_cursor(): # Replace VfbConnect with SolrTermInfoFetcher vc = SolrTermInfoFetcher() +def initialize_vfb_connect(): + """ + Initialize VFB_connect by triggering the lazy load of the vfb and nc properties. + This causes VFB_connect to cache all terms, which takes ~95 seconds on first call. + Subsequent calls to functions using vc.nc will be fast. + + :return: True if initialization successful, False otherwise + """ + try: + # Access the properties to trigger lazy loading + _ = vc.vfb + _ = vc.nc + return True + except Exception as e: + print(f"Failed to initialize VFB_connect: {e}") + return False + class Query: def __init__(self, query, label, function, takes, preview=0, preview_columns=[], preview_results=[], output_format="table", count=-1): self.query = query