federation icon indicating copy to clipboard operation
federation copied to clipboard

reduce the number of pruning operations

Open Geal opened this issue 2 years ago • 5 comments

Instead of checking a path against the entire list of paths every time, we only check against the list of already accepted paths.

Geal avatar Dec 07 '23 11:12 Geal

⚠️ No Changeset found

Latest commit: f8e7b103299eefd67849eb7b5b73865e9647cf8d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Dec 07 '23 11:12 changeset-bot[bot]

Deploy Preview for apollo-federation-docs canceled.

Name Link
Latest commit f8e7b103299eefd67849eb7b5b73865e9647cf8d
Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/6571ac1723196400095960aa

netlify[bot] avatar Dec 07 '23 11:12 netlify[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Dec 07 '23 11:12 codesandbox-ci[bot]

there's another potnetial optimization here: makingownPathIds a Set instead of an array: https://github.com/apollographql/federation/blob/3f7392b84f8b626b248b59ce81f193d0f0272045/query-graphs-js/src/graphPath.ts#L153

Since it is only used to be filled and the only part where it is read is in isOverridenBy`: https://github.com/apollographql/federation/blob/3f7392b84f8b626b248b59ce81f193d0f0272045/query-graphs-js/src/graphPath.ts#L770-L777

Geal avatar Dec 07 '23 15:12 Geal

I am not sure this PR is correct. In markOverriding: https://github.com/apollographql/federation/blob/3f7392b84f8b626b248b59ce81f193d0f0272045/query-graphs-js/src/graphPath.ts#L753-L768

we add the newId to thisPath.ownPathIds but we add it to overridingPathIds in the paths under otherOptions. So I don't think there's a transitive dependency here where A overrides B and B overrides C would mean A overrides C

Geal avatar Dec 07 '23 16:12 Geal