Skip to content

perf(endpoints): Add peephole optimizations to endpoint resolution codegen - #7305

Draft
alextwoods wants to merge 1 commit into
alexwoo/endpoints-bdd-pr3from
alexwoo/endpoints-bdd-pr4
Draft

perf(endpoints): Add peephole optimizations to endpoint resolution codegen#7305
alextwoods wants to merge 1 commit into
alexwoo/endpoints-bdd-pr3from
alexwoo/endpoints-bdd-pr4

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Motivation and Context

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

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

@alextwoods
alextwoods force-pushed the alexwoo/endpoints-bdd-pr4 branch 2 times, most recently from d5f508e to 7dcc87a Compare August 21, 2026 19:53
@alextwoods
alextwoods force-pushed the alexwoo/endpoints-bdd-pr4 branch from 7dcc87a to ceef90a Compare August 21, 2026 20:28
@alextwoods
alextwoods force-pushed the alexwoo/endpoints-bdd-pr4 branch from ceef90a to 04e5d8a Compare August 21, 2026 20:32
@alextwoods
alextwoods force-pushed the alexwoo/endpoints-bdd-pr4 branch from 04e5d8a to 4cd0955 Compare August 21, 2026 21:36
Add optimized Endpoint factory methods and a ThreadLocal partition
cache to reduce per-resolution allocation overhead:

1. Endpoint.ofAttribute(url, key, value) — uses singletonMap instead
   of HashMap(16) for the common single-attribute case (AUTH_SCHEMES)
2. Endpoint.of(url) — zero-attribute endpoint without builder
3. Endpoint.ofAttributes(url, k1, v1, k2, v2) — two-attribute case

Codegen changes:
- CodeGeneratorVisitor emits Endpoint.ofAttribute/of instead of
  builder pattern when attribute count is known at compile time
- BddResultCodeGeneratorVisitor emits same factories for BDD path

Runtime changes (RulesFunctions.java.resource):
- ThreadLocal awsPartition(region) cache retains last region/partition
  mapping (~100% hit rate in steady-state single-region usage)
- Removed uriEncode and isVirtualHostableS3Bucket caches (profiling
  showed cache-check overhead comparable to recomputation)
@alextwoods
alextwoods force-pushed the alexwoo/endpoints-bdd-pr4 branch from 4cd0955 to 7454d40 Compare August 21, 2026 22:37
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.

1 participant