Repository navigation
perf: faster aqueous equilibrium solve, results bit-identical - #338
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #338 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 148 148
Lines 17446 17507 +61
Branches 3542 3550 +8
=========================================
+ Hits 17446 17507 +61
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #337
plan_ratio_recipespends 99% of its time in 6,600aqueous_model.solvecalls. This speeds up each solve without changing any float.linear: no per-pivot lambda, row slices instead of indexed inner loops.evaluate: species indices and coefficients are built once per component set (itemgetter+sum(map(mul, ...)), same terms in the same order, sosumkeeps its compensated behaviour on 3.12+, see Results differ in the last digits between Python 3.11 and 3.12+ (the built-in sum changed) #334); phase vectors andlog10(water)hoisted; the exponent clamp is a conditional with the same NaN result asmax(-300, min(100, e)).model_qualificationis computed once per pattern of positive ligands and metals and returned as copies.Evidence
test_feasible_1_0about 250 s -> 122 s.outputs/test-runs/2026-11-26-perf-solver/, local).Not in this PR
A warm start across the pH grid in
refine_phwould be 2.2x faster on the same 400 solves, but results change in the last digits (max SI difference 2.8e-10, inside the solver tolerance). That changes numbers, so it needs your decision.