You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "japplis (via GitHub)" <gi...@apache.org> on 2025/02/04 13:15:48 UTC
[PR] Improve performance of encoding Uris [commons-vfs]
japplis opened a new pull request, #660:
URL: https://github.com/apache/commons-vfs/pull/660
If no encoding occurred for a uri (which is quite often the case), there is no need to convert the StringBuilder to a String, just return the input String.
JMH
Before
Benchmark Mode Cnt Score Error Units
`UriParserBenchmark.encode thrpt 25 5814265,085 ▒ 235637,894 ops/s`
After
Benchmark Mode Cnt Score Error Units
`UriParserBenchmark.encode thrpt 25 6764614,389 ▒ 213170,120 ops/s`
16.3% improvement
I've also attached a screenshot of JMC showing that a lot of time of the `UriParser.encode` is spend in the `StringBuilder.toString`

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated!
Before you push a pull request, review this list:
- [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
- [x] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself.
- [-] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve performance of encoding URIs [commons-vfs]
Posted by "japplis (via GitHub)" <gi...@apache.org>.
japplis commented on PR #660:
URL: https://github.com/apache/commons-vfs/pull/660#issuecomment-2753769232
Hi Gary, thank you for merging. I've tested the latest binary and everything works.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve performance of encoding Uris [commons-vfs]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #660:
URL: https://github.com/apache/commons-vfs/pull/660
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve performance of encoding URIs [commons-vfs]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #660:
URL: https://github.com/apache/commons-vfs/pull/660#issuecomment-2748179515
@japplis
I merged the PR. TY for your patience.
Please test your use case with git master or a `2.11.0-SNAPSHOT` build from https://repository.apache.org/content/repositories/snapshots
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org