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

Add top-level caches for Schema::Visibility #5157

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

rmosolgo
Copy link
Owner

Fixes #5154

This adds a top-level cache, like Schema makes when using Warden, but it supports lazy-loading. Currently, the cache rebuilds whenever something is lazy-loaded, but it could probably be made to grow in-place instead if it becomes a problem.

Running the same benchmark from the original issue shows good results:

$ N=1000 ruby types_bench.rb
GraphQL gem 2.4.2--accessing `GraphQL::Schema#types` 1000 times
                           user     system      total        real
Not using Visibility   0.291171   0.012367   0.303538 (  0.303684)
Using Visibility       0.156794   0.005118   0.161912 (  0.162134)

@rmosolgo rmosolgo added this to the 2.4.3 milestone Nov 11, 2024
@rmosolgo rmosolgo merged commit 0b49803 into master Nov 11, 2024
13 of 15 checks passed
@rmosolgo rmosolgo deleted the visibility-top-level-caches branch November 11, 2024 14:14
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.

Performance regression in 2.4: Schema#types is much slower to access repeatedly
1 participant