From 3c071f3202c2997ad95c1314c2a14762f2b05464 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 21 Oct 2025 17:35:41 +0100 Subject: [PATCH 1/2] Add initialize_vfb_connect function to trigger lazy loading of VFB_connect properties --- src/vfbquery/vfb_queries.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 From 2444723b6e0b78f97050a282550c5ffeb55c4c94 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 21 Oct 2025 16:36:49 +0000 Subject: [PATCH 2/2] Update performance test results [skip ci] --- performance.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/performance.md b/performance.md index 69cf58c..78efb82 100644 --- a/performance.md +++ b/performance.md @@ -1,9 +1,9 @@ # VFBquery Performance Test Results -**Test Date:** 2025-09-10 17:17:58 UTC -**Git Commit:** 969a842bbe07ad6e7631c8598ce5ec96f2ee493a +**Test Date:** 2025-10-21 16:36:49 UTC +**Git Commit:** 3c071f3202c2997ad95c1314c2a14762f2b05464 **Branch:** dev -**Workflow Run:** 17621490396 +**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.2426 seconds -- **VFB_00101567 Query Time**: 0.9094 seconds -- **Total Query Time**: 2.1520 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-09-10 17:17:58 UTC* +*Last updated: 2025-10-21 16:36:49 UTC*