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

perf: move id.eq fast path handling to node-model so it's shared between query running strategies #34520

Merged
merged 2 commits into from
Jan 18, 2022

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Jan 17, 2022

Description

It seems we lost our fast path for simple id.eq queries and only had a path like that for LMDB (experimental) indexes. I moved this to much earlier in the pipeline (node-model).

This should mean fast filters WON'T create a lookup table for it. The idea here is to limit the usage of it where possible, as (right now) those lookup tables cause nodes to be retained in memory and also not needed as we can already grab nodes by id.

Related Issues

[sc-44551]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 17, 2022
@pieh pieh added topic: GraphQL Related to Gatsby's GraphQL layer and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jan 17, 2022
@pieh pieh marked this pull request as ready for review January 17, 2022 21:13
@pieh pieh changed the title perf: move id: eq fast path handling to node_model so it's shared between query running strategies perf: move id: eq fast path handling to node-model so it's shared between query running strategies Jan 17, 2022
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice catch!

Object.keys(query.filter.id).length === 1
) {
if (tracer) {
runQueryActivity = reporter.phantomActivity(`runQuerySimpleIdEq`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of this phantomActivity? To see it in tracing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just for instrumentation. This code path skips runQuery activity, so I replaced it with something so traces make more sense

@pieh pieh merged commit d2ba1f9 into master Jan 18, 2022
@pieh pieh deleted the perf/fast-eq-id branch January 18, 2022 10:05
@KyleAMathews
Copy link
Contributor

Woot!

wardpeet pushed a commit to wardpeet/gatsby that referenced this pull request Jan 19, 2022
@marvinjude marvinjude changed the title perf: move id: eq fast path handling to node-model so it's shared between query running strategies perf: move id.eq fast path handling to node-model so it's shared between query running strategies Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: GraphQL Related to Gatsby's GraphQL layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants