Skip to content

Conversation

@dfa1
Copy link
Contributor

@dfa1 dfa1 commented Apr 14, 2025

This is intended as proposal for #140

Use `LongAdder` instead of `AtomicLong`, that is more suitable for high contention (see the javadoc).
@dfa1 dfa1 force-pushed the feature/long-adder branch from 40fa6e2 to 6942cc1 Compare April 14, 2025 14:13
@bbakerman bbakerman added this to the 5.0.0 milestone May 1, 2025
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;

public class AtomicVsAdder {
Copy link
Member

@bbakerman bbakerman May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in future a JMH benchmark is way better - we have them in dataloader recently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, if you don't mind, I would like to drop this class as LongAdder is well-known class in JDK built exactly for this use case

Copy link
Member

@bbakerman bbakerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do it

@bbakerman bbakerman merged commit 182ef06 into graphql-java:master May 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants