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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Bullet from Gemfile #5500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Remove Bullet from Gemfile #5500

wants to merge 1 commit into from

Conversation

javierm
Copy link
Member

@javierm javierm commented Apr 22, 2024

References

Background

We've been ignoring what the Bullet gem reports for at least 6 years (maybe more), but we were still updating the gem and maintaining the code in config/environments/ (which caused conflicts every time we run rails app:update to upgrade to a new Rails version). Maintaining it isn't a huge effort, but it's infinitely bigger than the benefits we get from it, which are zero.

Adding includes everywhere we query for records would be a huge maintenance effort and would make the code less readable, so I don't think it's worth it. We might do it occasionally if we detect a performance bottleneck.

We could also use a gem to automatically avoid the N+1 queries problem, like Goldiloader, ArLazyPreload or JitPreload. Benchmarks show that the performance improvements obtained by using these gems is about less than 10% (it depends a lot on the page being loaded, though), which IMHO doesn't justify adding yet another gem that patches ActiveRecord and that could be incompatible with other gems doing so.

Objectives

  • Have one less dependency to maintain (so now we only depend on 98 gems and 13 Node packages 馃槍)
  • Make it easier to run rails app:update and check the differences in the config/environments/development.rb and config/environments/test.rb files

Notes

There are a couple of open pull requests (at the time of writing, they've been open for about two years) in the Rails repository (rails/rails#45231 and rails/rails#45413) to automatically avoid N+1 queries as well. For now, we'll hope something similar is integrated in Rails itself in the future.

We've been ignoring what the Bullet gem reports for at least 6 years
(maybe more), but we were still updating the gem and maintaining the
code in `config/environments/` (which caused conflicts every time we run
`rails app:update` to upgrade to a new Rails version). Maintaining it
isn't a huge effort, but it's infinitely bigger than the benefits we get
from it, which are zero.

Adding `includes` everywhere we query for records would be a huge
maintenance effort and would make the code less readable, so I don't
think it's worth it. We might do it occasionally if we detect a
performance bottleneck.

We could also use a gem to automatically avoid the N+1 queries problem,
like Goldiloader [1], ArLazyPreload [2] or JitPreload [3]. Benchmarks
show that the performance improvements obtained by using these gems is
about less than 10% (it depends a lot on the page being loaded, though),
which IMHO doesn't justify adding yet another gem that patches
ActiveRecord and that could be incompatible with other gems doing so.

There are a couple of open pull requests (at the time of writing,
they've been open for about two years) in the Rails repository [4][5] to
automatically avoid N+1 queries as well. For now, we'll hope something
similar is integrated in Rails itself in the future.

[1] https://github.com/salsify/goldiloader
[2] https://github.com/DmitryTsepelev/ar_lazy_preload
[3] https://github.com/clio/jit_preloader/
[4] Pull request 45231 in https://github.com/rails/rails/
[5] Pull request 45413 in https://github.com/rails/rails/
@javierm javierm self-assigned this Apr 22, 2024
@javierm javierm added this to Reviewing in Consul Democracy Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Consul Democracy
  
Reviewing
Development

Successfully merging this pull request may close these issues.

None yet

1 participant