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

Add source generator for HandleInputCache #5761

Merged
merged 18 commits into from
Jun 19, 2023
Merged

Conversation

smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Apr 28, 2023

Prereqs:

Description Before After
Startup GameStart1 GameStart2
Options Options1 Options2

Sorry, something went wrong.


public static bool RequestsPositionalInput(Drawable drawable)
{
if (drawable is ISourceGeneratedInputCache sgInput && sgInput.KnownType == drawable.GetType())
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're gonna need to disable the suspicious type check inspections here because it doesn't look like R# can figure them out in the context of sourcegen...? Unless they're gonna go away after the sourcegen package is bumped I guess. (I wouldn't be surprised if they didn't, though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They'll go away with a package bump :)

@bdach
Copy link
Collaborator

bdach commented Jun 1, 2023

I've re-read this - all code review suggestions look applied, source looks sane. That said, I'd probably want to spend a bit of time setting up local unit test runs for both framework and game with this sourcegen enabled, to see if there are any regressions, before I'd be 100% comfortable with leaving an approval.

If you've already done this, or don't think that's necessary and that we can play it by ear whenever, then I can approve this and we can move forward. Otherwise, I'll set a few test runs up, but probably no sooner than this weekend.

@smoogipoo
Copy link
Contributor Author

Reviewing this over again myself for the 5th time now... I believe there's still an issue if a non-partial class is the leaf node.

./sigh

I think this is going to have to end up something like dependency injection after all.

@bdach
Copy link
Collaborator

bdach commented Jun 2, 2023

I'll hold off on the testing for now then until the code is a final state.

@smoogipoo
Copy link
Contributor Author

smoogipoo commented Jun 15, 2023

Added back KnownType as a method to handle non-partial leaf types.

This PR is now once again ready to go... I hope.

Just to be clear, this structure should be reviewed as a basis for all other such "simple" SGens. The IsLongRunning SGen is another likely candidate to use this model.

@bdach
Copy link
Collaborator

bdach commented Jun 18, 2023

So today I made a local sourcegen package, hooked it up to framework and a game checkout, ran full test suites on both (all passing), and confirmed the performance gains. I'm not sure it's time effective to be doing any further manual testing of this, so as far as I'm concerned this is probably as good to go as can get, and I'm gonna leave an approval.

Not sure how we want to approach releasing this, however. What I'd probably do is:

  • get next game release out without this change
  • force merge this to bypass code quality
  • immediately after, get a new sourcegen package out and bump it in a PR / on master even to make the code quality inspection go away
  • after that, get a framework package out with the sourcegen active, and bump framework on game-side so that we can dogfood this change during the interval between next release and release-after-next and see if anything funny falls out

But not sure my opinion holds any water here. @ppy/team-client thoughts?

@smoogipoo
Copy link
Contributor Author

smoogipoo commented Jun 19, 2023

What we've done in the past is pushed an SGen nuget package from the PR, and updated the package ref in the PR.

@peppy
Copy link
Member

peppy commented Jun 19, 2023

I'll go ahead with making the nuget package.

@bdach fwiw you didn't approve

bdach
bdach previously approved these changes Jun 19, 2023
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

whoops fixed

@peppy peppy self-requested a review June 19, 2023 05:08
@peppy peppy merged commit f9c72ae into ppy:master Jun 19, 2023
@smoogipoo smoogipoo deleted the input-cache-sgen branch September 11, 2023 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants