Skip to content

Commit 1d3a4f0

Browse files
authored
Merge pull request #30 from VirtualFlyBrain/dev
Adding initialize_vfb_connect
2 parents 0429621 + 1ccbebd commit 1d3a4f0

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

performance.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# VFBquery Performance Test Results
22

3-
**Test Date:** 2025-10-21 03:01:50 UTC
4-
**Git Commit:** 0b907afb912bf74823942a33ffb91ef50531c457
5-
**Branch:** main
6-
**Workflow Run:** 18671440241
3+
**Test Date:** 2025-10-21 16:36:49 UTC
4+
**Git Commit:** 3c071f3202c2997ad95c1314c2a14762f2b05464
5+
**Branch:** dev
6+
**Workflow Run:** 18690968894
77

88
## Test Overview
99

@@ -25,11 +25,11 @@ This performance test measures the execution time of VFB term info queries for s
2525

2626
**Test Status**: Performance test completed
2727

28-
- **FBbt_00003748 Query Time**: 1.4273 seconds
29-
- **VFB_00101567 Query Time**: 1.3915 seconds
30-
- **Total Query Time**: 2.8188 seconds
28+
- **FBbt_00003748 Query Time**: 1.5294 seconds
29+
- **VFB_00101567 Query Time**: 1.2568 seconds
30+
- **Total Query Time**: 2.7862 seconds
3131

3232
🎉 **Result**: All performance thresholds met!
3333

3434
---
35-
*Last updated: 2025-10-21 03:01:50 UTC*
35+
*Last updated: 2025-10-21 16:36:49 UTC*

src/vfbquery/vfb_queries.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ def get_dict_cursor():
5959
# Replace VfbConnect with SolrTermInfoFetcher
6060
vc = SolrTermInfoFetcher()
6161

62+
def initialize_vfb_connect():
63+
"""
64+
Initialize VFB_connect by triggering the lazy load of the vfb and nc properties.
65+
This causes VFB_connect to cache all terms, which takes ~95 seconds on first call.
66+
Subsequent calls to functions using vc.nc will be fast.
67+
68+
:return: True if initialization successful, False otherwise
69+
"""
70+
try:
71+
# Access the properties to trigger lazy loading
72+
_ = vc.vfb
73+
_ = vc.nc
74+
return True
75+
except Exception as e:
76+
print(f"Failed to initialize VFB_connect: {e}")
77+
return False
78+
6279
class Query:
6380
def __init__(self, query, label, function, takes, preview=0, preview_columns=[], preview_results=[], output_format="table", count=-1):
6481
self.query = query

0 commit comments

Comments
 (0)