Obligation chains re-parse the engine's text into SymPy for every obligation (GiNaC)

Open
#571 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
performance

Research direction

Read ClosedForm.of, sympify_symbolic_string, and the shared-chain code introduced in #556 to trace how GiNaC expressions are converted for each obligation. Profile the rw_counter_23 certificate with GiNaC before and after the change, then run make golden; done means each distribution is converted at most once per check and the golden results do not change.

Written by the indexing model from the issue text.

Description

area: engines bug priority: medium

Found while profiling rule PR 3b (#552); new cost since the shared chains of #556, visible on GiNaC.

ClosedForm.of calls sympify_symbolic_string, which calls parse_expr on the GiNaC text, once per obligation. For one certificate of rw_counter_23 that is 5 parses of about 3 s each, and with to_product_form (together) it makes up nearly all of the 20 s per certificate on GiNaC (Ψ itself takes about 1 s).

Proposal

Convert a distribution to its ClosedForm once per distribution and cache it, or pass the engine expression without going through text.

Done when

  • Each distribution is converted at most once per check.
  • Measured before and after on rw_counter_23 (GiNaC). make golden changes no result.
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LKlinke/Prodigy

All issues in LKlinke/Prodigy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.