-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Internal: Few memory allocation optimizations on the point-read hot-path #45505
Conversation
There was a problem hiding this 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<>(); }
No description provided.