Title: Reduce calculation for fragments in ExecutableNormalizedOperation by dondonz · Pull Request #2911 · graphql-java/graphql-java · GitHub
Open Graph Title: Reduce calculation for fragments in ExecutableNormalizedOperation by dondonz · Pull Request #2911 · graphql-java/graphql-java
X Title: Reduce calculation for fragments in ExecutableNormalizedOperation by dondonz · Pull Request #2911 · graphql-java/graphql-java
Description: After parsing and validating an incoming GraphQL operation, the engine creates a normalized version of that operation, the ExecutableNormalizedOperation. For fragments, there is a little more work involved to determine the possible types. Inside narrowDownPossibleObjects, there is a set intersection between the current set of possible objects and the set of types from the resolved type condition. This set intersection can be expensive for very large queries with hundreds of fragments. This PR includes one such example. In almost every case in the example query, one of the sets being compared only has one member. For example, the resolved types set often has only 1 member, because an inline fragment on a concrete type has only one possible type. It would be equivalent, and much cheaper, to calculate via Set contains rather than intersection. And I've added a more general tweak to always pass the smallest set first to Guava's Sets.intersection. The implementation is faster when the first set is smaller. Benchmark results Baseline Benchmark Mode Cnt Score Error Units NQExtraLargeBenchmark.benchMarkThroughput thrpt 9 274.744 ± 14.909 ops/s NQExtraLargeBenchmark.benchMarkAvgTime avgt 9 3.658 ± 0.310 ms/op Optimised Benchmark Mode Cnt Score Error Units NQExtraLargeBenchmark.benchMarkThroughput thrpt 9 333.346 ± 25.986 ops/s NQExtraLargeBenchmark.benchMarkAvgTime avgt 9 2.905 ± 0.124 ms/op Note: For throughput, a higher number is better. For average time, a lower number is better.
Open Graph Description: After parsing and validating an incoming GraphQL operation, the engine creates a normalized version of that operation, the ExecutableNormalizedOperation. For fragments, there is a little more work ...
X Description: After parsing and validating an incoming GraphQL operation, the engine creates a normalized version of that operation, the ExecutableNormalizedOperation. For fragments, there is a little more work ...
Opengraph URL: https://github.com/graphql-java/graphql-java/pull/2911
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:64f72978-4eea-a661-1011-5ffe22e67210 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DE80:3F6476:288F86:35C5B3:6A5FEDA8 |
| html-safe-nonce | 54907d0864cdd6fb06aed5010f316644da44dc72be9e5206cf2f3448a9137966 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTgwOjNGNjQ3NjoyODhGODY6MzVDNUIzOjZBNUZFREE4IiwidmlzaXRvcl9pZCI6IjM3MTYwNTU3ODU2MDI1NDMwMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c1668051178b6bf3076a13da61e705fc3f982683eb332e00d8e6954219114e39 |
| hovercard-subject-tag | pull_request:1017160884 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/graphql-java/graphql-java/pull/2911/files |
| twitter:image | https://avatars.githubusercontent.com/u/13839920?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/13839920?s=400&v=4 |
| og:image:alt | After parsing and validating an incoming GraphQL operation, the engine creates a normalized version of that operation, the ExecutableNormalizedOperation. For fragments, there is a little more work ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba296ecd3a3521238fe43b3b3b08cc09207ddc21173e16ee656db03803de8e2b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git |
| octolytics-dimension-user_id | 14289921 |
| octolytics-dimension-user_login | graphql-java |
| octolytics-dimension-repository_id | 38602457 |
| octolytics-dimension-repository_nwo | graphql-java/graphql-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38602457 |
| octolytics-dimension-repository_network_root_nwo | graphql-java/graphql-java |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6e50fb37e29e4aa0df6386cb485e58b0e3ca97ab |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width