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

Optimize DetermineService #3365

Merged
merged 2 commits into from
Jul 4, 2024
Merged

Conversation

danielmarbach
Copy link
Contributor

Description

Heavily optimizes DetermineService method which is also used on the Signing request path

Motivation and Context

image

https://github.com/danielmarbach/aws-sdk-net-benchmarks/blob/main/DetermineService.cs

Proof of embedding (also works on .NET)

https://sharplab.io/#gist:c381a4555b6ad204c609be729ee4e864

Testing

I added a theory test with some inline data to make sure the existing functionality is preserved

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

@danielmarbach danielmarbach changed the base branch from main to v4-development June 30, 2024 13:08
@danielmarbach danielmarbach changed the base branch from v4-development to v4-development-merge June 30, 2024 13:08
@danielmarbach danielmarbach changed the base branch from v4-development-merge to v4-development June 30, 2024 13:08
}

// Compiler trick to directly refer to static data in the assembly
private static ReadOnlySpan<char> DoubleSlash => new[] { '/', '/' };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevenaw you might enjoy this ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a neat trick, thanks! I'll have to look out for opportunities to use this

@danielmarbach
Copy link
Contributor Author

@normj @dscpinheiro this is ready

@dscpinheiro dscpinheiro merged commit c5e8e47 into aws:v4-development Jul 4, 2024
@danielmarbach danielmarbach deleted the service-url branch July 4, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants