Visitar URL original
gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments by WolframAlph · Pull Request #128761 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260624061155/https://github.com/python/cpython/pull/128761
Skip to content
/ cpython Public

gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments#128761

Closed
WolframAlph wants to merge 11 commits into
python:mainfrom
WolframAlph:fix-stmt-end
Closed

gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments#128761
WolframAlph wants to merge 11 commits into
python:mainfrom
WolframAlph:fix-stmt-end

Conversation

@WolframAlph

@WolframAlph WolframAlph commented Jan 12, 2025 •

Copy link
Copy Markdown
Contributor

@WolframAlph

Copy link
Copy Markdown
Contributor Author

@picnixz can you take a look?

@picnixz

picnixz commented Jan 23, 2025 •

Copy link
Copy Markdown
Member

Can you first resolve the conflicts and make the CI green for this one since it affects generated code? It seems we're indeed doing unnecessary operations, so it's good to fix this. I'd recommend also asking @Eclips4 or @iritkatriel to have a look once it's ready as Mark may not have the bandwidth.

@picnixz

picnixz commented Jan 23, 2025

Copy link
Copy Markdown
Member

Now, not sure if it's worth a NEWS entry or not. We could gain a bit of performance but only if we have such comments in the code which I don't know whether we do.

@WolframAlph

Copy link
Copy Markdown
Contributor Author

I will resolve conflicts and regenerate cases so we will see if there are such cases

@WolframAlph

WolframAlph commented Jan 24, 2025 •

Copy link
Copy Markdown
Contributor Author

Okay so after resolving conflicts and regenerating cases I noticed that there are changes to those files. No performance related but there is weird reordering of reloading stack & subsequent comment. (You can see this in 8afca3fd). So after some debugging I realized that my initial fix probably should be revisited since it introduces this awkward side effect. In the end I used different approach to fix this. Basically old way of finding escaping calls boundaries but with 1 step in between of merging subsequent calls to avoid redundant spills. More robust solution that fixes initial issue with no side effects.

@WolframAlph WolframAlph changed the title gh-128760: Skip comments when looking for statement end for escaping calls gh-128760: Merge subsequent escaping calls to avoid redundant stack spills when escaping calls are separated by comments Jan 24, 2025
@WolframAlph

Copy link
Copy Markdown
Contributor Author

@Eclips4 , @picnixz is off now for 2 weeks, can you take a look?

@Eclips4

Eclips4 commented Jan 27, 2025

Copy link
Copy Markdown
Member

I'll take a look at it later today, sorry for the delay!

@Eclips4 Eclips4 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This looks quite good. Also, it would be good to hear Ken's opinion on that.

@Fidget-Spinner

Copy link
Copy Markdown
Member

This introduces some amount of complexity for a use case that we dont currently have. So I'm wondering if it's worth it.

@Eclips4

Eclips4 commented Jan 27, 2025

Copy link
Copy Markdown
Member

This introduces some amount of complexity for a use case that we dont currently have. So I'm wondering if it's worth it.

This is the reason why I asked for your opinion 🙂. We might encounter something like this in the future, so the question in my mind is: "Is it worth introducing complexity into the analyzer?" In my very personal opinion, yes, it is worth it. I guess you and @markshannon should decide whether it's worthwhile or not, since both of you have a lot of experience with Tools/cases_generator.

@WolframAlph

Copy link
Copy Markdown
Contributor Author

I don't think this adds a lot of complexity, but we may run into this at some point so it's worth the fix IMO.

@WolframAlph

WolframAlph commented Feb 17, 2025 •

Copy link
Copy Markdown
Contributor Author

Just checking in, @Fidget-Spinner do you want to merge or close this PR then?

@Fidget-Spinner

Copy link
Copy Markdown
Member

I think we should only introduce this PR when we bump into it as an actual problem. So could you close the PR please but keep the branch?

@WolframAlph

Copy link
Copy Markdown
Contributor Author

Closing per request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants