Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**An (experimental) breadth-first GraphQL executor for Ruby**

Depth-first execution resolves every object field descending down a response tree, while breadth-first visits every _selection position_ once with an aggregated set of objects. The breadth-first approach tends to be much faster due to fewer resolver calls and intermediary promises.
Depth-first execution resolves every object field descending down a response tree, while breadth-first visits every _selection position_ once with an aggregated set of objects. The breadth-first approach is much faster due to fewer resolver calls and intermediary promises.

```shell
graphql-ruby: 140002 resolvers
Expand Down Expand Up @@ -43,5 +43,5 @@ Breadth-first then runs a single resolver per document selection, and coalesces

While bigger responses will always take longer to process, the workload is your own business logic with very little GraphQL execution overhead. Other advantages:

* Eliminates the need for DataLoader promises, because resolvers are inherently batched.
* Executes via flat queuing without deep recursion and huge call stacks.
* Eliminates boilerplate need for DataLoader promises, because resolvers are inherently batched.
* Executes via flat queuing without deep recursion and large call stacks.
1 change: 0 additions & 1 deletion lib/graphql/cardinal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ module Cardinal
require_relative "cardinal/loader"
require_relative "cardinal/field_resolvers"
require_relative "cardinal/executor"
require_relative "cardinal/depth_executor"
require_relative "cardinal/version"
95 changes: 0 additions & 95 deletions lib/graphql/cardinal/depth_executor.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/graphql/cardinal/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,5 @@ def report_exception(message, path: @path.dup)
# todo: hook up some kind of error reporting...
end
end

class BreadthExecutor < Executor; end
end
end
9 changes: 0 additions & 9 deletions test/graphql/cardinal/depth_executor_test.rb

This file was deleted.

6 changes: 3 additions & 3 deletions test/graphql/cardinal/executor/loaders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_splits_loaders_by_group_across_fields
}
}

executor = GraphQL::Cardinal::BreadthExecutor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
executor = GraphQL::Cardinal::Executor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
assert_equal expected, executor.perform
assert_equal [["Apple", "Banana"], ["Coconut"]], FancyLoader.perform_keys
end
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_maintains_ordered_selections_around_object_fields
}
}

executor = GraphQL::Cardinal::BreadthExecutor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
executor = GraphQL::Cardinal::Executor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
result = executor.perform
assert_equal expected, result
assert_equal result.dig("data", "widget").keys, expected.dig("data", "widget").keys
Expand Down Expand Up @@ -164,7 +164,7 @@ def test_maintains_ordered_selections_around_leaf_fields
}
}

executor = GraphQL::Cardinal::BreadthExecutor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
executor = GraphQL::Cardinal::Executor.new(LOADER_SCHEMA, LOADER_RESOLVERS, document, source)
result = executor.perform
assert_equal expected, result
assert_equal result.dig("data", "widget").keys, expected.dig("data", "widget").keys
Expand Down
7 changes: 1 addition & 6 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
require_relative './fixtures'

def breadth_exec(query, source, variables: {}, context: {})
executor = GraphQL::Cardinal::BreadthExecutor.new(SCHEMA, BREADTH_RESOLVERS, GraphQL.parse(query), source)
executor.perform
end

def depth_exec(query, source, variables: {}, context: {})
executor = GraphQL::Cardinal::DepthExecutor.new(SCHEMA, DEPTH_RESOLVERS, GraphQL.parse(query), source)
executor = GraphQL::Cardinal::Executor.new(SCHEMA, BREADTH_RESOLVERS, GraphQL.parse(query), source)
executor.perform
end