Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid exponential time complexity in codeprinter #23841

Merged
merged 1 commit into from
Jul 27, 2022

Conversation

bjodah
Copy link
Member

@bjodah bjodah commented Jul 27, 2022

References to other Issues or PRs

Fixes #23839

Brief description of what is fixed or changed

There is no need to try to call a python string. Previously work was done to parenthesize the arguments even though it could be determined that this work was in vain.

Other comments

I wouldn't be surprised if it's possible to construct other pathogenic expressions exhibiting exponential runtime. But this fix should nevertheless be harmless.

cc @eschnett, does this help for your real world use case as well?

Release Notes

  • printing
    • Better performance when passing user_functions to the printers.

@sympy-bot
Copy link

sympy-bot commented Jul 27, 2022

Hi, I am the SymPy bot (v167). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • printing
    • Better performance when passing user_functions to the printers. (#23841 by @bjodah)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.12.

Click here to see the pull request description that was parsed.
#### References to other Issues or PRs
Fixes #23839


#### Brief description of what is fixed or changed
There is no need to try to call a python string. Previously work was done to parenthesize the arguments even though it could be determined that this work was in vain.

#### Other comments
I wouldn't be surprised if it's possible to construct other pathogenic expressions exhibiting exponential runtime. But this fix should nevertheless be harmless.

cc @eschnett, does this help for your real world use case as well?

#### Release Notes
<!-- BEGIN RELEASE NOTES -->
* printing
  * Better performance when passing `user_functions` to the printers.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@github-actions
Copy link

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

@oscarbenjamin
Copy link
Collaborator

Looks good.

@oscarbenjamin oscarbenjamin merged commit 41da4ce into sympy:master Jul 27, 2022
@bjodah bjodah deleted the fix-runtime-printing branch July 27, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ccode excessively slow when using user_functions
3 participants