/lecharny-challenge

The Lecharny Challenge

Primary LanguageJavaOtherNOASSERTION

The Lecharny Challenge

Build Status

The goal of this repository is to check the performance of various implementations of an algorithm that:

  • given an input string

  • replaces all sequences of `\r\n `, `\n\r `, `\r ` or `\n ` with an empty string

Algorithm must be run in the JVM.

Executing the benchmark

./gradlew jmh

Correctness

The current version of the repository doesn’t check the correctness of the algorithms. Some have been proposed which are incorrect!

Unit tests can be launched with:

./gradlew test

Integration with IntelliJ

To use in IntelliJ, first run:

./gradlew idea

Then open the generated project.

Results

Below you will find the latest results of the benchmark, as executed on Travis CI. This section is automatically updated.

Results on JDK 8

Table 1. Table Benchmark results for string of length 10 on 1.8.0_31-b13
Rank Method name Score Error (99.9%)

1

unfold_cedric_groovy_bytecode

12419.097576 ops/ms

±458.455542 ops/ms

2

unfold_cedric_ultimate2

11524.904731 ops/ms

±666.21508 ops/ms

3

unfold_henri_submethods

11488.363753 ops/ms

±671.588613 ops/ms

4

unfold_cedric_groovy

11174.810181 ops/ms

±462.282027 ops/ms

5

unfold_henri_noplusplus

11175.685567 ops/ms

±780.585313 ops/ms

6

unfold_cedric_improved

10513.470898 ops/ms

±678.919507 ops/ms

7

unfold_cedric_ultimate2_ternary

9966.606477 ops/ms

±362.027599 ops/ms

8

unfold_cedric_ultimate2_with_else

10339.670639 ops/ms

±785.722225 ops/ms

9

unfold_cedric_ultimate

9725.052979 ops/ms

±439.883214 ops/ms

10

unfold_olivier2

9675.667659 ops/ms

±751.5411 ops/ms

11

unfold_cedric

8958.91786 ops/ms

±530.667819 ops/ms

12

unfold_henri_unsafe

8736.48777 ops/ms

±455.023759 ops/ms

13

unfold_henri_newarray

8097.344317 ops/ms

±325.147051 ops/ms

14

unfold_henri_arraycopy

7642.014567 ops/ms

±309.706984 ops/ms

15

unfold_mbo

4906.704772 ops/ms

±297.031283 ops/ms

16

unfold_unfold_common

2467.547191 ops/ms

±144.878713 ops/ms

17

unfold_regexp_compiled

1272.634591 ops/ms

±133.785178 ops/ms

18

unfold_regexp

595.388811 ops/ms

±52.27726 ops/ms

Table 2. Table Benchmark results for string of length 100 on 1.8.0_31-b13
Rank Method name Score Error (99.9%)

1

unfold_henri_submethods

2243.671013 ops/ms

±173.908709 ops/ms

2

unfold_cedric_groovy_bytecode

2060.639382 ops/ms

±118.35026 ops/ms

3

unfold_cedric_ultimate2_ternary

2005.943506 ops/ms

±118.405046 ops/ms

4

unfold_henri_unsafe

1985.638652 ops/ms

±102.710527 ops/ms

5

unfold_cedric_improved

1917.934378 ops/ms

±78.411122 ops/ms

6

unfold_cedric_ultimate2

1904.964311 ops/ms

±79.059848 ops/ms

7

unfold_cedric

1873.071049 ops/ms

±83.468155 ops/ms

8

unfold_cedric_ultimate

1863.209711 ops/ms

±74.972045 ops/ms

9

unfold_henri_newarray

1824.136328 ops/ms

±75.334293 ops/ms

10

unfold_cedric_groovy

1807.863598 ops/ms

±69.596639 ops/ms

11

unfold_henri_noplusplus

1827.793916 ops/ms

±101.543768 ops/ms

12

unfold_cedric_ultimate2_with_else

1819.778028 ops/ms

±118.92894 ops/ms

13

unfold_olivier2

1415.163421 ops/ms

±68.077889 ops/ms

14

unfold_henri_arraycopy

1173.662984 ops/ms

±82.597036 ops/ms

15

unfold_mbo

916.567851 ops/ms

±64.959938 ops/ms

16

unfold_unfold_common

520.63022 ops/ms

±33.945404 ops/ms

17

unfold_regexp_compiled

152.525262 ops/ms

±13.450241 ops/ms

18

unfold_regexp

124.760325 ops/ms

±12.350367 ops/ms

Table 3. Table Benchmark results for string of length 1000 on 1.8.0_31-b13
Rank Method name Score Error (99.9%)

1

unfold_cedric_ultimate2_ternary

226.845449 ops/ms

±8.987402 ops/ms

2

unfold_cedric_groovy_bytecode

220.725286 ops/ms

±8.806618 ops/ms

3

unfold_cedric_ultimate2_with_else

220.774934 ops/ms

±11.432734 ops/ms

4

unfold_henri_noplusplus

217.321365 ops/ms

±10.840238 ops/ms

5

unfold_cedric_ultimate2

214.550734 ops/ms

±8.539285 ops/ms

6

unfold_henri_submethods

221.681144 ops/ms

±15.785728 ops/ms

7

unfold_cedric_improved

216.479458 ops/ms

±11.462393 ops/ms

8

unfold_cedric_groovy

216.990974 ops/ms

±13.258135 ops/ms

9

unfold_cedric

214.13067 ops/ms

±11.371823 ops/ms

10

unfold_henri_unsafe

210.126036 ops/ms

±8.823264 ops/ms

11

unfold_cedric_ultimate

211.861753 ops/ms

±15.525682 ops/ms

12

unfold_henri_newarray

168.229582 ops/ms

±17.591137 ops/ms

13

unfold_olivier2

157.757123 ops/ms

±9.48091 ops/ms

14

unfold_henri_arraycopy

140.572364 ops/ms

±5.392124 ops/ms

15

unfold_mbo

135.352438 ops/ms

±10.998065 ops/ms

16

unfold_unfold_common

37.122742 ops/ms

±2.250556 ops/ms

17

unfold_regexp_compiled

17.227399 ops/ms

±0.924805 ops/ms

18

unfold_regexp

15.860737 ops/ms

±0.993859 ops/ms

Results on JDK 7

Table 4. Table Benchmark results for string of length 10 on 1.7.0_75-b13
Rank Method name Score Error (99.9%)

1

unfold_cedric_ultimate

10997.826301 ops/ms

±602.466697 ops/ms

2

unfold_cedric_groovy

10872.606492 ops/ms

±728.105386 ops/ms

3

unfold_cedric_ultimate2

10576.627126 ops/ms

±469.151759 ops/ms

4

unfold_cedric_ultimate2_ternary

10681.767828 ops/ms

±639.867739 ops/ms

5

unfold_olivier2

9929.458489 ops/ms

±552.416991 ops/ms

6

unfold_cedric_groovy_bytecode

10040.547487 ops/ms

±663.650606 ops/ms

7

unfold_cedric_ultimate2_with_else

10325.479114 ops/ms

±996.679597 ops/ms

8

unfold_cedric_improved

9220.241219 ops/ms

±693.26439 ops/ms

9

unfold_cedric

8528.12683 ops/ms

±446.946111 ops/ms

10

unfold_henri_newarray

8585.615939 ops/ms

±632.299439 ops/ms

11

unfold_henri_arraycopy

8227.585392 ops/ms

±371.996952 ops/ms

12

unfold_henri_submethods

8514.902272 ops/ms

±869.682429 ops/ms

13

unfold_henri_unsafe

7628.728425 ops/ms

±467.25411 ops/ms

14

unfold_henri_noplusplus

7299.802972 ops/ms

±826.58231 ops/ms

15

unfold_mbo

5263.955863 ops/ms

±293.690536 ops/ms

16

unfold_unfold_common

2441.816295 ops/ms

±64.87427 ops/ms

17

unfold_regexp_compiled

1336.048362 ops/ms

±25.195519 ops/ms

18

unfold_regexp

674.031553 ops/ms

±13.429436 ops/ms

Table 5. Table Benchmark results for string of length 100 on 1.7.0_75-b13
Rank Method name Score Error (99.9%)

1

unfold_cedric_ultimate

2295.644215 ops/ms

±131.357414 ops/ms

2

unfold_cedric_ultimate2_ternary

2259.167874 ops/ms

±98.372213 ops/ms

3

unfold_cedric

2243.461774 ops/ms

±124.004684 ops/ms

4

unfold_cedric_groovy

2093.611897 ops/ms

±105.713699 ops/ms

5

unfold_cedric_ultimate2_with_else

2082.053588 ops/ms

±109.188522 ops/ms

6

unfold_cedric_ultimate2

2127.07668 ops/ms

±169.61026 ops/ms

7

unfold_cedric_groovy_bytecode

2110.024547 ops/ms

±209.709775 ops/ms

8

unfold_henri_submethods

1956.048588 ops/ms

±164.569834 ops/ms

9

unfold_henri_newarray

1862.589379 ops/ms

±170.034525 ops/ms

10

unfold_henri_arraycopy

1755.024538 ops/ms

±98.916633 ops/ms

11

unfold_henri_unsafe

1683.468014 ops/ms

±112.263334 ops/ms

12

unfold_cedric_improved

1651.29165 ops/ms

±84.355376 ops/ms

13

unfold_henri_noplusplus

1614.447354 ops/ms

±112.454221 ops/ms

14

unfold_olivier2

1533.292056 ops/ms

±91.62525 ops/ms

15

unfold_mbo

1269.772558 ops/ms

±48.193287 ops/ms

16

unfold_unfold_common

533.208987 ops/ms

±36.116649 ops/ms

17

unfold_regexp_compiled

175.705716 ops/ms

±7.122307 ops/ms

18

unfold_regexp

147.545517 ops/ms

±8.556775 ops/ms

Table 6. Table Benchmark results for string of length 1000 on 1.7.0_75-b13
Rank Method name Score Error (99.9%)

1

unfold_cedric_ultimate

263.378827 ops/ms

±13.089815 ops/ms

2

unfold_cedric_groovy

259.66009 ops/ms

±9.383269 ops/ms

3

unfold_cedric_ultimate2_ternary

262.351076 ops/ms

±15.570974 ops/ms

4

unfold_cedric_ultimate2_with_else

252.330184 ops/ms

±8.155953 ops/ms

5

unfold_cedric_ultimate2

250.086055 ops/ms

±16.52759 ops/ms

6

unfold_henri_submethods

246.394952 ops/ms

±16.035919 ops/ms

7

unfold_cedric

234.476694 ops/ms

±16.042577 ops/ms

8

unfold_cedric_groovy_bytecode

242.253007 ops/ms

±26.923419 ops/ms

9

unfold_cedric_improved

211.226187 ops/ms

±9.418537 ops/ms

10

unfold_henri_noplusplus

216.270965 ops/ms

±17.204995 ops/ms

11

unfold_olivier2

197.126653 ops/ms

±5.406307 ops/ms

12

unfold_henri_unsafe

197.062671 ops/ms

±6.63158 ops/ms

13

unfold_henri_arraycopy

195.810485 ops/ms

±9.05922 ops/ms

14

unfold_mbo

174.787274 ops/ms

±8.240503 ops/ms

15

unfold_henri_newarray

173.597576 ops/ms

±23.716838 ops/ms

16

unfold_unfold_common

45.553601 ops/ms

±2.20512 ops/ms

17

unfold_regexp

18.514202 ops/ms

±0.853285 ops/ms

18

unfold_regexp_compiled

18.644011 ops/ms

±1.442136 ops/ms

Results on JDK 6

Please check the CI build Build Status because the results for JDK 6 cannot be automatically fetched.