Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary array copying in ConditionValidationState.advance() #3109

Conversation

sachindshinde
Copy link
Contributor

We were using concat() in ConditionValidationState.advance(), which was frequently copying the array. Shifting this to use push() instead increases performance significantly for some graphs.

@sachindshinde sachindshinde requested a review from a team as a code owner August 7, 2024 21:58
Copy link

netlify bot commented Aug 7, 2024

👷 Deploy request for apollo-federation-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit efdce1e

Copy link

changeset-bot bot commented Aug 7, 2024

🦋 Changeset detected

Latest commit: c08c2f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@apollo/federation-internals Patch
@apollo/gateway Patch
@apollo/composition Patch
@apollo/query-planner Patch
@apollo/query-graphs Patch
@apollo/subgraph Patch
apollo-federation-integration-testsuite Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

codesandbox-ci bot commented Aug 7, 2024

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.

@sachindshinde sachindshinde marked this pull request as draft August 7, 2024 22:01
@sachindshinde sachindshinde force-pushed the sachin/remove-concat-from-condition-validation-advance branch from b64653d to efdce1e Compare August 21, 2024 17:06
@sachindshinde sachindshinde changed the base branch from main to next August 21, 2024 17:06
@sachindshinde sachindshinde marked this pull request as ready for review August 21, 2024 17:06
@dariuszkuc dariuszkuc merged commit 02c2a34 into apollographql:next Aug 21, 2024
15 checks passed
sachindshinde pushed a commit that referenced this pull request Aug 22, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to
version-2.9.0-beta, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-2.9.0-beta` is currently in **pre mode** so this branch has
prereleases rather than normal releases. If you want to exit
prereleases, run `changeset pre exit` on `version-2.9.0-beta`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/[email protected]

### Minor Changes

- Implements two new directives for defining custom costs for demand
control. The `@cost` directive allows setting a custom weight to a
particular field in the graph, overriding the default cost calculation.
The `@listSize` directive gives the cost calculator information about
how to estimate the size of lists returned by subgraphs. This can either
be a static size or a value derived from input arguments, such as paging
parameters.
([#3074](#3074))

### Patch Changes

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Updated dependencies
\[[`acfe3193429c7f99b4fc564b20828aaa8659a75c`](acfe319),
[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Minor Changes

- Implements two new directives for defining custom costs for demand
control. The `@cost` directive allows setting a custom weight to a
particular field in the graph, overriding the default cost calculation.
The `@listSize` directive gives the cost calculator information about
how to estimate the size of lists returned by subgraphs. This can either
be a static size or a value derived from input arguments, such as paging
parameters.
([#3074](#3074))

### Patch Changes

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Fix issue where variable was not passed into subgraph when embedded in
a fragment
([#3119](#3119))

## @apollo/[email protected]

### Patch Changes

- Avoid type explosion for inline fragments where the type condition is
an interface that implements the parent type.
([#3122](#3122))

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Avoid type explosion for inline fragments where the type condition is
an interface that implements the parent type.
([#3122](#3122))

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Fix issue where variable was not passed into subgraph when embedded in
a fragment
([#3119](#3119))

- Updated dependencies
\[[`acfe3193429c7f99b4fc564b20828aaa8659a75c`](acfe319),
[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]

## [email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
tninesling pushed a commit that referenced this pull request Aug 27, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/[email protected]

### Minor Changes

- Implements two new directives for defining custom costs for demand
control. The `@cost` directive allows setting a custom weight to a
particular field in the graph, overriding the default cost calculation.
The `@listSize` directive gives the cost calculator information about
how to estimate the size of lists returned by subgraphs. This can either
be a static size or a value derived from input arguments, such as paging
parameters.
([#3074](#3074))

### Patch Changes

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Updated dependencies
\[[`acfe3193429c7f99b4fc564b20828aaa8659a75c`](acfe319),
[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Minor Changes

- Implements two new directives for defining custom costs for demand
control. The `@cost` directive allows setting a custom weight to a
particular field in the graph, overriding the default cost calculation.
The `@listSize` directive gives the cost calculator information about
how to estimate the size of lists returned by subgraphs. This can either
be a static size or a value derived from input arguments, such as paging
parameters.
([#3074](#3074))

### Patch Changes

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Fix issue where variable was not passed into subgraph when embedded in
a fragment
([#3119](#3119))

## @apollo/[email protected]

### Patch Changes

- Avoid type explosion for inline fragments where the type condition is
an interface that implements the parent type.
([#3122](#3122))

- Reduce memory overhead during satisfiability checking when there are
many options.
([#3109](#3109))

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Avoid type explosion for inline fragments where the type condition is
an interface that implements the parent type.
([#3122](#3122))

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Fix issue where variable was not passed into subgraph when embedded in
a fragment
([#3119](#3119))

- Updated dependencies
\[[`acfe3193429c7f99b4fc564b20828aaa8659a75c`](acfe319),
[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]
    -   @apollo/[email protected]

## @apollo/[email protected]

### Patch Changes

- Updated dependencies
\[[`02c2a34a62c3717a4885449172e404f19ebf66c9`](02c2a34),
[`0ccfd937d4b4a576f890665ceebbd7986fac5d0c`](0ccfd93),
[`e0a5075c0d12a0e2f7ef303b246e3216a139d3e0`](e0a5075)]:
    -   @apollo/[email protected]

## [email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants