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

Remove a bunch of (unspecialized) generics #1073

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Dec 9, 2020

Motivation:

The state machine code in the BaseCallHandler works returns an 'Action'
to perform as a result of prodding the state machine. These actions are
generic over the request and response type of the RPC as the often
include instructions like 'forward this request to the interceptors' and
so on. When these generics are unspecialized we burn a bunch of
instructions in the runtime, and in many cases they can be represented
without generics entirely.

Modifications:

  • Shuffle some of the state machine code around in BaseCallHandler such
    that neither State or Action are generic

Result:

  • Instructions executed in the unary server benchmark decreases by ~20%

@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Dec 9, 2020
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

LGTM, nice patch!

Motivation:

The state machine code in the BaseCallHandler works returns an 'Action'
to perform as a result of prodding the state machine. These actions are
generic over the request and response type of the RPC as the often
include instructions like 'forward this request to the interceptors' and
so on. When these generics are unspecialized we burn a bunch of
instructions in the runtime, and in many cases they can be represented
without generics entirely.

Modifications:

- Shuffle some of the state machine code around in BaseCallHandler such
  that neither State or Action are generic

Result:

- Instructions executed in the unary server benchmark decreases by ~20%
@glbrntt glbrntt force-pushed the gb-server-perf-actions branch from 975c611 to 87af230 Compare December 10, 2020 09:18
@glbrntt glbrntt merged commit a250f3f into grpc:main Dec 10, 2020
@glbrntt glbrntt deleted the gb-server-perf-actions branch December 10, 2020 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants