Skip to content

Commit 8d47b91

Browse files
authored
Update README.md
1 parent 886d945 commit 8d47b91

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
_**The original prototype of the core algorithm for Shopify's _GraphQL Cardinal_ engine**_
44

5+
GraphQL requests have two dimensions: _depth_ and _breadth_. The depth dimension is finite as defined by the request document, while the breadth dimension scales by the width of the response data (and can grow extremely large).
6+
57
![Breadth/Depth](./images/graphql-axes.png)
68

7-
GraphQL requests have two dimensions: _depth_ and _breadth_. The depth dimension is finite as defined by the request document, while the breadth dimension scales by the width of the response data (and can grow extremely large).
9+
Traditional GraphQL implementations execute _depth-first_, which resolves every field of every object in the response individually, making resolver overhead (resolver calls, tracing, intermediary promises) scale by **depth × breadth**. To execute _breadth-first_, we instead resolve each selection depth only once with an aggregated breadth of objects, so resolver overhead now scales by **depth-only**.
810

911
![Execution flows](./images/exec-flow.png)
1012

11-
Traditional GraphQL implementations execute _depth-first_, which resolves every field of every object in the response individually, making resolver overhead (resolver calls, tracing, intermediary promises) scale by **depth × breadth**. To execute _breadth-first_, we instead resolve each selection depth only once with an aggregated breadth of objects, so resolver overhead now scales by **depth-only**. This makes processing list repetitions considerably faster.
13+
The breadth-first design makes processing list repetitions considerably faster.
1214

1315
```shell
1416
graphql-ruby (depth): 140002 resolvers

0 commit comments

Comments
 (0)