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

Use APIs that don't compile a Pattern each call #27654

Merged
merged 4 commits into from
Mar 16, 2022

Conversation

alzimmermsft
Copy link
Member

Use APIs that don't compile a Pattern on each call (String.replaceAll, String.replaceFirst, String.split [when split String is > 1 character]). Uncertain if the changed code is in a hot path but the overall reduction of using Pattern.compile should improve performance a good deal.

@alzimmermsft alzimmermsft added Cosmos Client This issue points to a problem in the data-plane of the library. labels Mar 14, 2022
@alzimmermsft alzimmermsft self-assigned this Mar 14, 2022
Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot @alzimmermsft - worth running full live CI on this PR.
Wondering, how did you find these string pattern issues ?

@alzimmermsft
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alzimmermsft
Copy link
Member Author

alzimmermsft commented Mar 14, 2022

Wondering, how did you find these string pattern issues ?

Just prior experience with doing performance improvements in azure-core and reading through source code for Java versions. It's possible that different JVMs implement the methods slightly differently but if we can develop against it the better.

http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/String.java#l2164
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/String.java#l2209
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/String.java#l2316

@alzimmermsft
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alzimmermsft alzimmermsft enabled auto-merge (squash) March 16, 2022 13:55
@alzimmermsft alzimmermsft merged commit b95cd40 into Azure:main Mar 16, 2022
@alzimmermsft alzimmermsft deleted the AzCosmos_UseCompiledPatterns branch April 4, 2022 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants