You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2016/06/02 11:28:59 UTC

[jira] [Commented] (OAK-4421) Optimize Revison fromString and toString implementation

    [ https://issues.apache.org/jira/browse/OAK-4421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15312154#comment-15312154 ] 

Chetan Mehrotra commented on OAK-4421:
--------------------------------------

To measure the impact of any change I have implemented a benchmark based on JMH [1] which takes care of warmup and coming up with more reliable numbers. The benchmark module is currently at [2]

h3. Optimized Revision.toString
Below is the benchmark result where optimized toString is compared against the default and shows 400% better throughput

{noformat}
# Run complete. Total time: 00:00:26

Benchmark                                               Mode  Cnt         Score         Error  Units
RevisionFromStringBenchmark.revisionFromStringDefault  thrpt    5  10911800.194 ± 1355884.153  ops/s
RevisionFromStringBenchmark.revisionFromStringNew      thrpt    5  58061940.924 ± 6897525.993  ops/s
{noformat}

h3. Optimized Revision.fromString
Below is the benchmark result where optimized fromString is compared against the default and shows 400% better throughput

{noformat}
# Run complete. Total time: 00:00:38

Benchmark                                               Mode  Cnt         Score         Error  Units
RevisionFromStringBenchmark.revisionFromStringDefault  thrpt   10  10802847.895 ±  318041.329  ops/s
RevisionFromStringBenchmark.revisionFromStringNew      thrpt   10  56397389.037 ± 5161688.259  ops/s
{noformat}

[1] http://openjdk.java.net/projects/code-tools/jmh/
[2] https://github.com/chetanmeh/oak-jmh

> Optimize Revison fromString and toString implementation
> -------------------------------------------------------
>
>                 Key: OAK-4421
>                 URL: https://issues.apache.org/jira/browse/OAK-4421
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: documentmk
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.6
>
>
> Current implementation of Revision {{fromString}} and {{toString}} make use of std JDK API to perform string manipulation. While running some performance test it was seen that these 2 methods are called quite frequently and that adds up to some decent times. Further they also generate quite a bit of short lived objects.
> It would be worthwhile to perform a micro benchmark of these method and optimize them further such that they perform better and also generate less garbage. The micro optimized code would be bit more complex but if performance numbers are better we can look into changing the current implementation



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)