Skip to content

Breaking change: using LongAdder instead of AtomicLong - #186

Merged
bbakerman merged 1 commit into
graphql-java:masterfrom
dfa1:feature/long-adder
May 12, 2025
Merged

Breaking change: using LongAdder instead of AtomicLong#186
bbakerman merged 1 commit into
graphql-java:masterfrom
dfa1:feature/long-adder

Conversation

@dfa1

@dfa1 dfa1 commented Apr 14, 2025

Copy link
Copy Markdown
Contributor

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 {

@bbakerman bbakerman May 1, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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

@bbakerman bbakerman left a comment

Copy link
Copy Markdown
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants