Skip to content

Internal: Few memory allocation optimizations on the point-read hot-path #45505

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

Conversation

FabianMeiswinkel
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 09:42
@FabianMeiswinkel FabianMeiswinkel requested review from kirankumarkolli and a team as code owners May 28, 2025 09:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces memory allocation optimizations on the point-read hot-path by adjusting builder expected sizes and streamlining header and URI handling.

  • Adjusts the expected size for map builders in response headers and diagnostics snapshots
  • Introduces shared empty URI constants and conditional replica path initialization in request arguments
  • Refines default header handling in ThinClientStoreModel and RxGatewayStoreModel while correcting a typo in an error message

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
RntbdResponseHeaders.java Adjusts builder expected size for map construction
RntbdRequestArgs.java Introduces emptyUri and emptyUriPath constants with conditional replicaPath initialization
UserAgentContainer.java Adds BASE_USER_AGENT_STRING constant for fallback user-agent value
ThinClientStoreModel.java Utilizes precomputed defaultHeaders and removes a redundant null check on request properties
RxGatewayStoreModel.java Uses a HashMap with an initial capacity and improves user-agent header handling; fixes error message typo
CosmosDiagnosticsSystemUsageSnapshot.java Updates builder expected size for creating immutable maps
Comments suppressed due to low confidence (2)

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java:121

  • Correct the typo in the error message: 'userAGentContainer' should be 'userAgentContainer'.
checkNotNull(userAgentContainer, "Argument 'userAGentContainer' must not be null.");

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ThinClientStoreModel.java:125

  • The null check and initialization of request.properties has been removed; please confirm that request.properties is guaranteed to be initialized elsewhere to avoid potential null pointer issues.
if (request.properties == null) { request.properties = new HashMap<>(); }

@FabianMeiswinkel FabianMeiswinkel merged commit 7627334 into Azure:main May 29, 2025
29 checks passed
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.

3 participants