JavaMoney / jsr354-api

JSR 354 - Money and Currency API
http://javamoney.org
Apache License 2.0
357 stars 79 forks source link

treating not null and null with new resources of Java 8 #24

Closed otaviojava closed 10 years ago

otaviojava commented 10 years ago

Treating null and not null using java.util.Objects will faster than using operator, because the JIT action. Running the bench with JMH[1] the result was:

Benchmark (size) Mode Samples Mean Mean error Units m.NullBenchmark.isNotNull 1000000 thrpt 20 251.020 36.826 ops/s m.NullBenchmark.isNotNullUtils 1000000 thrpt 20 286.275 2.388 ops/s m.NullBenchmark.isNull 1000000 thrpt 20 289.536 2.463 ops/s m.NullBenchmark.isNullUtils 1000000 thrpt 20 290.583 2.101 ops/s

Another points of null can replace with Optional or using new methods on map.

[1] http://openjdk.java.net/projects/code-tools/jmh/

atsticks commented 10 years ago

Wow, great work!

atsticks commented 10 years ago

BUT, PLEASE; PLEASE; PLEASE: execute the complete test suite on each module changed before do any checkins, especially such relatively large improvements:

I had to fixed quite a couple of things completely broken, see my checkin comments:

otaviojava commented 10 years ago

@atsticks Sorry. I will take care it in next actions Thank you for fix it