Repository navigation
A union of solves solves each equation once - #2310
Merged
Merged
Conversation
Unite and Intersect asked Any() of their sequence and then folded it with Aggregate, which enumerates it a second time. The solvers hand Unite a lazy Select of solves, one per root of a substitution or per factor, so the first of them was solved twice. A Select over a list or a range knows its count without computing anything, which is why it went unseen; over a plain iterator Any() computes the first element. Each is now enumerated once into an array and folded. Measured per Solve after a warm-up, the answers unchanged: x^5 = |x^3 + 1| + 1 allocates 140 MB where it allocated 733 MB, and takes 362 ms where it took 721; e^(2x) - 3e^x + 2 = 0 403 KB where 668 KB, sqrt(x + 1) = x - 1 829 KB where 1205 KB. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2310 +/- ##
==========================================
- Coverage 86.78% 86.77% -0.02%
==========================================
Files 311 311
Lines 68032 68032
Branches 19763 19763
==========================================
- Hits 59039 59032 -7
- Misses 4872 4877 +5
- Partials 4121 4123 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…el performance baseline The gate reported IMPROVED: SolveHard allocates 9,526,556 B/op, 4.7% below the 9,996,973 recorded at 5edd6a1 on 2026-10-21, and SolveMediumHard 1,366,964, 3.1% below 1,410,754. The file is the one this pull request's own Benchmark job wrote, measured-CommonFunctionsInterVersion.json from its artifact, copied over the baseline as version_performance_control.md describes. Every other gated row is within its band: SimplifyHard +2.4%, SolveEasy -2.0%. Co-Authored-By: Claude Opus 5.5 (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.
UniteandIntersectweresets.Any() ? sets.Aggregate(...) : Empty, which enumerates the sequence twice. The solvers passUnitea lazySelectof solves, one per root of a substitution or per factor, soAny()solved the first equation to see there was one, andAggregatesolved it again. Each sequence is now enumerated once into an array and folded.Bytes allocated per
Solve, after a warm-up, same answers:Solve("x")x^5 = abs(x^3 + 1) + 1e^(2x) - 3 e^x + 2 = 0sqrt(x + 1) = x - 1sin(x)^2 = 1/4x^4 - 5x^2 + 4 = 0Selectover a list or a range knows its count, soAny()computes nothing. Over a plain iterator it computes the first element. The new test counts through ayielditerator, and master computes the first set twice (4 against 3).performance-baseline.jsonis now the file this PR's own Benchmark job wrote. Every other gated row is within its band.Found while tracing why the route in #2309 ran twice per spelling. No issue was filed.
🤖 Generated with Claude Code