Per level tracking simplification and performance improvements by andimarek · Pull Request #4128 · graphql-java/graphql-java

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the PerLevelDataLoaderDispatchStrategy to simplify level tracking and improve performance by replacing synchronized blocks with lock-free compare-and-swap (CAS) operations. The refactoring reduces the complexity of tracking mechanisms and introduces atomic operations for thread safety.

  • Simplified per-level tracking by consolidating multiple tracking maps into a single state object
  • Replaced synchronized blocks with CAS-based atomic operations for better performance
  • Restructured subscription execution flow with separate callback methods

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
PerLevelDataLoaderDispatchStrategy.java Core refactoring with new StateForLevel class and CAS-based updates
LevelMap.java Updated toString format with additional brackets
DataLoaderDispatchStrategy.java Split subscription callback into separate methods
SubscriptionExecutionStrategy.java Updated to use new subscription callback methods
ExecutionStrategy.java Reordered executeObject call timing
LevelMapTest.groovy Updated test assertions for new toString format
DataLoaderPerformance.java Removed benchmark annotations and added main method for testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.