Experiment with LongAdder
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
The current implementation of the `Counter` in the metrics use the `concurrent-ruby` `AtomicFixnum` class for managing the counter (docs https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib/concurrent/atomic/atomic_fixnum.rb). The java implementation of this code uses Java's `AtomicLong`.
This class gives OK performance, but since multiples thread can change the counter it might be a good idea to investigate if replacing the code with a `LongAdder` would actually yield benefits.
See:
- http://blog.palominolabs.com/2014/02/10/java-8-performance-improvements-longadder-vs-atomiclong/
- https://minddotout.wordpress.com/2013/05/11/java-8-concurrency-longadder/
Java 8 comes with but Java 7 doesn't, but an implementation exist for java 7, ES actually use it and its also present in `concurrent-ruby` code https://github.com/ruby-concurrency/concurrent-ruby/blob/master/ext/com/concurrent_ruby/ext/jsr166e/LongAdder.java
Contributor guide
Assessment
This issue has not been assessed yet.