perf: speed up unit tests by 33% and fix FactorValue hash collision#1182
Merged
Jammy2211 merged 1 commit intomain_buildfrom Apr 6, 2026
Merged
perf: speed up unit tests by 33% and fix FactorValue hash collision#1182Jammy2211 merged 1 commit intomain_buildfrom
Jammy2211 merged 1 commit intomain_buildfrom
Conversation
Reduces test suite runtime from 61s to 41s (33%) by shrinking observation counts, EP iteration steps, grid search steps, and sampler maxcall values in tests that used more data than needed to validate correctness. Also fixes a bug in AbstractJacobian.grad() where FactorValue (id=0) hash-collided with GaussianPrior id=0, causing test_gaussian to fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces test suite runtime from 61s to 41s (33%) by shrinking observation counts, EP iteration steps, grid search steps, and sampler maxcall values in tests that used more data than needed to validate correctness.
Also fixes a latent bug in
AbstractJacobian.grad()whereFactorValue(which getsid=0from the global counter) hash-collided with anyGaussianPriorthat also receivedid=0, causing the gradient dict to silently drop a variable. This manifested as aKeyErrorintest_gaussian.API Changes
None — internal changes only.
Test Plan
test_gaussian(previously failing) now passesFull API Changes (for automation & release notes)
Changed Behaviour
AbstractJacobian.grad()inautofit/graphical/factor_graphs/jacobians.py— fixed bug whereFactorValuekey (id=0) could collide with aGaussianPriorkey (id=0) in the gradient dict, silently dropping that variable's gradient. No public API change.Migration
None required — this is a bugfix with no signature or behavioural contract change.
🤖 Generated with Claude Code