You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by ijuma <gi...@git.apache.org> on 2017/06/04 16:09:52 UTC

[GitHub] kafka pull request #3234: MINOR: Optimise performance of `Topic.validate()`

GitHub user ijuma opened a pull request:

    https://github.com/apache/kafka/pull/3234

    MINOR: Optimise performance of `Topic.validate()`

    I included a JMH benchmark and the results follow. The
    implementation in this PR takes no more than 1/10th
    of the time when compared to trunk. I also included
    results for an alternative implementation that is a little
    slower than the one in the PR.
    
    Trunk:
    TopicBenchmark.testValidate                                topic  avgt   15  134.107 ±  3.956  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  316.241 ± 13.379  ns/op
    TopicBenchmark.testValidate  very-long-topic-name_with_more_text  avgt   15  636.026 ± 30.272  ns/op
    
    Implementation in the PR:
    TopicBenchmark.testValidate                                topic  avgt   15  13.153 ± 0.383  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  26.139 ± 0.896  ns/op
    TopicBenchmark.testValidate  very-long-topic-name.with_more_text  avgt   15  44.829 ± 1.390  ns/op
    
    Alternative implementation where boolean validChar = Character.isLetterOrDigit(c) || c == '.' || c == '_' || c == '-';
    TopicBenchmark.testValidate                                topic  avgt   15  18.883 ± 1.044  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  36.696 ± 1.220  ns/op
    TopicBenchmark.testValidate  very-long-topic-name_with_more_text  avgt   15  65.956 ± 0.669  ns/op

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ijuma/kafka optimise-topic-is-valid

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/3234.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3234
    
----
commit 9439326b5689d20860c7400f4fcfd5912c88b5db
Author: Ismael Juma <is...@juma.me.uk>
Date:   2017-06-04T16:08:31Z

    MINOR: Optimise performance of `Topic.validate()`
    
    I included a JMH benchmark and the results follow. The
    implementation in this PR takes no more than 1/10th
    of the time when compared to trunk. I also included
    results for an alternative implementation that is a little
    slower than the one in the PR.
    
    Trunk:
    TopicBenchmark.testValidate                                topic  avgt   15  134.107 ±  3.956  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  316.241 ± 13.379  ns/op
    TopicBenchmark.testValidate  very-long-topic-name_with_more_text  avgt   15  636.026 ± 30.272  ns/op
    
    Implementation in the PR:
    TopicBenchmark.testValidate                                topic  avgt   15  13.153 ± 0.383  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  26.139 ± 0.896  ns/op
    TopicBenchmark.testValidate  very-long-topic-name.with_more_text  avgt   15  44.829 ± 1.390  ns/op
    
    Alternative implementation where boolean validChar = Character.isLetterOrDigit(c) || c == '.' || c == '_' || c == '-';
    TopicBenchmark.testValidate                                topic  avgt   15  18.883 ± 1.044  ns/op
    TopicBenchmark.testValidate                    longer-topic-name  avgt   15  36.696 ± 1.220  ns/op
    TopicBenchmark.testValidate  very-long-topic-name_with_more_text  avgt   15  65.956 ± 0.669  ns/op

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] kafka pull request #3234: MINOR: Optimise performance of `Topic.validate()`

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/kafka/pull/3234


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---