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 more efficient variants of URLEncoder::encode and URLDecoder::decode #13030

Merged
merged 3 commits into from
May 1, 2024

Conversation

yashmayya
Copy link
Collaborator

@yashmayya yashmayya commented Apr 30, 2024

  • The URLEncoder::encode(String, String) and URLDecoder::decode(String, String) variants are slightly less efficient than the URLEncoder::encode(String, Charset) and URLDecoder::decode(String, Charset) variants since the former include an additional charset lookup by name.
  • The newer variants were added in Java 10 and since the minimum version we now support is Java 11, these can be safely used.
  • The performance difference should be extremely minor since the older variants do use a cache for charset lookup and we're only ever using UTF_8, but this is an easy change anyway. There's also the nice added benefit wherein we no longer need to unnecessarily handle the checked UnsupportedEncodingException.

@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2024

Codecov Report

Attention: Patch coverage is 26.66667% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 35.03%. Comparing base (59551e4) to head (41a4aef).
Report is 387 commits behind head on master.

Files Patch % Lines
...spi/utils/builder/ControllerRequestURLBuilder.java 0.00% 4 Missing ⚠️
...che/pinot/server/api/resources/TablesResource.java 0.00% 3 Missing ⚠️
.../org/apache/pinot/plugin/filesystem/S3PinotFS.java 0.00% 2 Missing ⚠️
...n/batch/standalone/SegmentGenerationJobRunner.java 0.00% 1 Missing ⚠️
...he/pinot/segment/local/utils/SegmentPushUtils.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #13030       +/-   ##
=============================================
- Coverage     61.75%   35.03%   -26.73%     
+ Complexity      207        6      -201     
=============================================
  Files          2436     2427        -9     
  Lines        133233   132946      -287     
  Branches      20636    20612       -24     
=============================================
- Hits          82274    46573    -35701     
- Misses        44911    82979    +38068     
+ Partials       6048     3394     -2654     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 <0.01% <0.00%> (-61.71%) ⬇️
java-21 35.03% <26.66%> (-26.60%) ⬇️
skip-bytebuffers-false 35.01% <26.66%> (-26.73%) ⬇️
skip-bytebuffers-true 35.01% <26.66%> (+7.28%) ⬆️
temurin 35.03% <26.66%> (-26.73%) ⬇️
unittests 46.55% <44.44%> (-15.20%) ⬇️
unittests1 46.55% <44.44%> (-0.34%) ⬇️
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yashmayya yashmayya marked this pull request as ready for review April 30, 2024 05:44
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

LGTM!

@Jackie-Jiang Jackie-Jiang merged commit bf28a83 into apache:master May 1, 2024
19 of 20 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.

4 participants