Skip to content

Conversation

@shanto268
Copy link
Collaborator

No description provided.

- Add @lru_cache decorator for E01 and anharmonicity calculations
- Cache key is rounded (EJ, EC) tuple to increase hit rate
- Each parallel worker builds its own cache for repeated calculations
- Reduces HWC test time from ~6min to ~72sec

Benchmark: 16.5M row dataset
- Before: ~360 seconds
- After: ~72 seconds
- Speedup: ~5x
The lru_cache is per-process, so when using joblib Parallel,
the main process shows 0 hits/misses. Added guard for this case.
Key optimizations:
- Pre-compute unique EC values in main process before parallelization
- Use numpy searchsorted for O(log n) value mapping instead of O(n) loop
- Vectorized EC calculation with numba
- LRU cache for transmon E01/anharmonicity calculations
- Separate g-only parallel processing after pre-computation

Benchmark (16.5M row half-wave cavity dataset):
- Before: ~6 minutes (360 seconds)
- After: ~51 seconds for H params calculation
- Total test: ~2:11 (includes 3x find_closest calls)
- Speedup: ~7x for Hamiltonian parameter calculation

Also:
- Updated release notes for v0.4.0 with performance improvements
- Fixed duplicate print statement
@shanto268 shanto268 merged commit bfda098 into LFL-Lab:master Jan 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant