Engine performance: SymPy finiteness bookkeeping, SymEngine at full size, simplification on large examples
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- performance
Research direction
Start with the benchmark set in benchmarks/ and the linked issues #264, #285, #330, and #331 for the original details. Profile each engine on polya_urn_coins, log_series_coins, digitRecognition, and nested_while.ppy to identify the reported bottlenecks. Done means each performance issue is fixed or explained, nested_while.ppy runs well below the CI limit without a higher timeout, and the benchmarks show the gains.
Written by the indexing model from the issue text.
Description
Collects the open performance problems of the engines (formerly #264, #285, #330, #331; their descriptions stay readable there). All exist on main. The benchmark set from #325 (benchmarks/, see #190) is the yardstick: every fix shows its effect there.
Items
- SymPy recomputes finiteness (#331, #285):
GeneratingFunction.__init__recomputes_is_finite_functionwhenever a caller passesfinite=False; SymPy is about 4x slower than GiNaC onpolya_urn_coinsandlog_series_coins. The equivalence testnested_while.ppyon SymPy takes 67–100 s of its 120 s limit in the CI on Python 3.11 because of 98 finiteness checks (onecanceleach). Likely one fix: derive the finiteness flag from the operation instead of re-checking every result. - SymEngine at full size (#330):
polya_urn_coinswith 8 outer / 30 inner iterations takes more than 120 s on SymEngine, 21 s on GiNaC; at 3/10 it is 1.3 s, so a further cause appears only at larger sizes. Not profiled. - SymPy with simplification on
digitRecognition(#264): more than 13 min with simplification (the CLI default), 47 s without; 7840observestatements and coefficients with thousands of digits. Probably simplification after every step; skip it where it cannot help (pure rationals). - SymPy
_term_generator(from an independent code audit, verified onmain):generating_function.pyiterates a finitePolyby repeatedly subtracting the leading term (poly -= poly.EC() * poly.EM()), quadratic in the number of terms; a micro-benchmark showed 25x–250x for 26–401 terms when iteratingreversed(poly.terms())once and rebuilding the monomials frompoly.gens. Keep the order of states; tests for univariate, multivariate, constant and zero polynomials. Quick fix. - SymEngine's SymPy fallbacks (same audit): the SymEngine engine falls back to SymPy in comparison, coefficient sums, iteration, expected values, substitution and unilateral approximation. Collect them in one place, document why each exists (missing functionality, exact semantics, convenience), and measure them on the benchmark set; replace one by native SymEngine only when the measurement shows a gain and exactness is kept.
Done when
Each item is profiled and fixed or explained, nested_while.ppy stays well below the CI limit without a raised timeout, and the benchmark set shows the gains.
- Dominant language
- Python
- Stars
- 6
- Forks
- 2
- Avg merge
- 1h 52m
- Merged PRs (30d)
- 187
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LKlinke/Prodigy
-
area: engines bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: gui bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: gui bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
area: engines bug priority: medium
Maintainers usually reply within 1 day
-
area: maintenance priority: low
Maintainers usually reply within 1 day
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day