Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JMH performance benchmark #162

Merged
merged 1 commit into from
Mar 10, 2019
Merged

Add JMH performance benchmark #162

merged 1 commit into from
Mar 10, 2019

Conversation

drekbour
Copy link
Contributor

@drekbour drekbour commented Mar 9, 2019

Add some JMH tests covering performance of PojoBuilder-generated code in different scenarios. These are only run manually (./gradlew jmh) and are obviously not comparable across developers' machines. Below are the numbers on a very low-spec box.

They show the current cost of using withOptionalProperties also put to bed any idea that a ThreadLocal builder is better than creating a new one (yet to test how this scales vs multiple-threads-cloning-a-common-template)

I also checked the comparison of super.clone() vs manually copying each field and clone was actually 5% faster.

Benchmark                                                                           Mode  Cnt    Score   Error  Units
PojobuilderPerformance.constructManually                                           thrpt       244.293          ops/s
PojobuilderPerformance.constructViaBuilder_private                                 thrpt       150.680          ops/s
PojobuilderPerformance.constructViaBuilder_shared                                  thrpt       134.398          ops/s
PojobuilderPerformance.constructViaBuilder_threadlocal                             thrpt       136.498          ops/s
PojobuilderPerformance.constructViaButMethod_private                               thrpt       141.584          ops/s
PojobuilderPerformance.constructViaButMethod_shared                                thrpt       136.249          ops/s
PojobuilderPerformance.constructViaCopyMethod_private                              thrpt       142.470          ops/s
PojobuilderPerformance.constructViaCopyMethod_shared                               thrpt       125.537          ops/s
PojobuilderPerformance.constructViaOptionalBuilder_withOptionalProperties          thrpt       139.792          ops/s
PojobuilderPerformance.constructViaOptionalBuilder_withRealProperties              thrpt        64.063          ops/s
PojobuilderPerformance.constructViaOptionalSupplierBuilder_withOptionalProperties  thrpt       126.587          ops/s
PojobuilderPerformance.constructViaOptionalSupplierBuilder_withRealProperties      thrpt        58.997          ops/s
PojobuilderPerformance.constructViaOptionalSupplierBuilder_withSuppliedProperties  thrpt        93.973          ops/s
PojobuilderPerformance.constructViaSupplierBuilder_withRealProperties              thrpt       145.212          ops/s
PojobuilderPerformance.constructViaSupplierBuilder_withSuppliedProperties          thrpt        83.957          ops/s

@coveralls
Copy link

coveralls commented Mar 9, 2019

Coverage Status

Coverage decreased (-0.04%) to 87.555% when pulling f19dbda on drekbour:jmh into c4f7948 on mkarneim:master.

@mkarneim mkarneim merged commit f19dbda into mkarneim:master Mar 10, 2019
@drekbour drekbour deleted the jmh branch March 10, 2019 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants