jabrena / functional-rosetta-stone

A repository to review the main concepts about Functional Programming with Java
https://jabrena.github.io/functional-rosetta-stone/
Apache License 2.0
9 stars 3 forks source link

Try+Optional overhead benchmark #19

Closed ibaca closed 5 years ago

ibaca commented 5 years ago
Benchmark                                                           Mode  Cnt          Score          Error   Units
OptionalBenchmark.using_nullable                                   thrpt    5  339562950.964 ± 15606175.571   ops/s
OptionalBenchmark.using_nullable:·gc.alloc.rate                    thrpt    5         ≈ 10⁻⁴                 MB/sec
OptionalBenchmark.using_nullable:·gc.alloc.rate.norm               thrpt    5         ≈ 10⁻⁷                   B/op
OptionalBenchmark.using_nullable:·gc.count                         thrpt    5            ≈ 0                 counts
OptionalBenchmark.using_try                                        thrpt    5  190674685.529 ± 19209760.748   ops/s
OptionalBenchmark.using_try:·gc.alloc.rate                         thrpt    5       2644.106 ±      266.855  MB/sec
OptionalBenchmark.using_try:·gc.alloc.rate.norm                    thrpt    5         16.000 ±        0.001    B/op
OptionalBenchmark.using_try:·gc.churn.G1_Eden_Space                thrpt    5       2657.738 ±      276.765  MB/sec
OptionalBenchmark.using_try:·gc.churn.G1_Eden_Space.norm           thrpt    5         16.082 ±        0.269    B/op
OptionalBenchmark.using_try:·gc.churn.G1_Old_Gen                   thrpt    5          0.003 ±        0.006  MB/sec
OptionalBenchmark.using_try:·gc.churn.G1_Old_Gen.norm              thrpt    5         ≈ 10⁻⁵                   B/op
OptionalBenchmark.using_try:·gc.count                              thrpt    5        230.000                 counts
OptionalBenchmark.using_try:·gc.time                               thrpt    5        145.000                     ms
OptionalBenchmark.using_try_optional                               thrpt    5  139484109.891 ±  4805521.130   ops/s
OptionalBenchmark.using_try_optional:·gc.alloc.rate                thrpt    5       3867.406 ±      131.473  MB/sec
OptionalBenchmark.using_try_optional:·gc.alloc.rate.norm           thrpt    5         32.000 ±        0.001    B/op
OptionalBenchmark.using_try_optional:·gc.churn.G1_Eden_Space       thrpt    5       3883.416 ±      125.693  MB/sec
OptionalBenchmark.using_try_optional:·gc.churn.G1_Eden_Space.norm  thrpt    5         32.133 ±        0.192    B/op
OptionalBenchmark.using_try_optional:·gc.churn.G1_Old_Gen          thrpt    5          0.007 ±        0.009  MB/sec
OptionalBenchmark.using_try_optional:·gc.churn.G1_Old_Gen.norm     thrpt    5         ≈ 10⁻⁴                   B/op
OptionalBenchmark.using_try_optional:·gc.count                     thrpt    5        327.000                 counts
OptionalBenchmark.using_try_optional:·gc.time                      thrpt    5        203.000                     ms
ibaca commented 5 years ago

No vayas ha dedicar tiempo a repasar esto, he creado el PR para q lo veas, si no te cuadra simplemente rechazalo. El benchmark es poco útil en cualqueir caso, sólo re-confirma lo obvio 😉.

PD: no me pidas cambios que no los voy a aplicar 😅🤣

jabrena commented 5 years ago

Estuvo muy bien la discusion. Tengo que meter cosas de RxJava con Schedulers. Buen area para mas Esgrima guena :)

ibaca commented 5 years ago

Rx tiene una batería grande de benchmarks 😲 https://github.com/ReactiveX/RxJava/tree/2.x/src/jmh