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 N+1 when loading Flipper UI Index #888

Closed

Conversation

ericboehs
Copy link

Our project has many feature toggles (400+), when accessing the mounted Flipper UI app, it would take 20+ seconds for all the Feature look ups (M2 Max). On slower machines it takes minutes.

This two line change improves load speeds dramatically (22s -> 0.7s).

@ericboehs
Copy link
Author

ericboehs commented Sep 30, 2024

Closing as I'm not able to reproduce with a test app.

rails new flipper-test-app -d postgresql --skip-bundle
cd flipper-test-app; git init .; git add .; git commit -m "Initial commit"
bundle add flipper flipper-ui flipper-active_record; bundle

# Add flipper ui to routes
sed -i '' '/Rails.application.routes.draw do/a\
  mount Flipper::UI.app(Flipper) => "/flipper"
' config/routes.rb

rails generate flipper:active_record
bin/setup
rails runner '1.upto(500) { |i| Flipper.add("feature_#{i}") }'
bin/rails s
time curl http://localhost:3000/flipper/features

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.

1 participant