Created
February 19, 2014 09:19
-
-
Save CodingFabian/9088631 to your computer and use it in GitHub Desktop.
2nd Benchmark for my concurrency improvements for joda time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Improving JodaTime Concurrency for DateFormatter | |
Model Name: MacBook Pro | |
Model Identifier: MacBookPro11,3 | |
Processor Name: Intel Core i7 | |
Processor Speed: 2,3 GHz | |
Number of Processors: 1 | |
Total Number of Cores: 4 | |
L2 Cache (per Core): 256 KB | |
L3 Cache: 6 MB | |
Memory: 16 GB | |
Using JMH and Java 7u45, Tested Single Threaded and with 3 Threads | |
# Before the changes (https://github.com/JodaOrg/joda-time/commit/f17223a4974f3e55097456441d7386735c97ffd6) | |
java -jar target/microbenchmarks.jar -f 2 -wi 5 -i 10 -t 1 ".*JodaFormatterBenchmark.*" | |
Benchmark Mode Samples Mean Mean error Units | |
o.j.t.JodaFormatterBenchmark.DateTimeFormatter thrpt 20 45279.628 211.954 ops/ms | |
o.j.t.JodaFormatterBenchmark.forPattern thrpt 20 11965.186 48.087 ops/ms | |
o.j.t.JodaFormatterBenchmark.print thrpt 20 2407.998 17.647 ops/ms | |
java -jar target/microbenchmarks.jar -f 2 -wi 5 -i 10 -t 3 ".*JodaFormatterBenchmark.*" | |
Benchmark Mode Samples Mean Mean error Units | |
o.j.t.JodaFormatterBenchmark.DateTimeFormatter thrpt 20 22353.853 925.899 ops/ms | |
o.j.t.JodaFormatterBenchmark.forPattern thrpt 20 5556.762 101.369 ops/ms | |
o.j.t.JodaFormatterBenchmark.print thrpt 20 6490.630 146.582 ops/ms | |
Conclusion: The synchronization hurts multithreading performance, reducing efficiency to 50%. Only printing scales, as it uses the array based STYLE_CACHE. | |
# After this change (https://github.com/CodingFabian/joda-time/tree/avoid_lock_contention_formatter_cache) | |
java -jar target/microbenchmarks.jar -f 2 -wi 5 -i 10 -t 1 ".*JodaFormatterBenchmark.*" | |
Benchmark Mode Samples Mean Mean error Units | |
o.j.t.JodaFormatterBenchmark.DateTimeFormatter thrpt 20 485731.372 5084.285 ops/ms | |
o.j.t.JodaFormatterBenchmark.forPattern thrpt 20 40250.715 516.932 ops/ms | |
o.j.t.JodaFormatterBenchmark.print thrpt 20 2392.888 32.233 ops/ms | |
java -jar target/microbenchmarks.jar -f 2 -wi 5 -i 10 -t 3 ".*JodaFormatterBenchmark.*" | |
Benchmark Mode Samples Mean Mean error Units | |
o.j.t.JodaFormatterBenchmark.DateTimeFormatter thrpt 20 1397938.775 7000.980 ops/ms | |
o.j.t.JodaFormatterBenchmark.forPattern thrpt 20 116386.948 2117.401 ops/ms | |
o.j.t.JodaFormatterBenchmark.print thrpt 20 6600.845 101.646 ops/ms | |
Conclusion: `DateTimeFormat.fullDate()` gains an order of magnitude improvement due to change from LinkedHashMap, other parts gain 3-4 times improvement and scale with number of concurrent threads. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment