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 loading ActionController::Base when loading ActionMailer::Base #45142

Conversation

jonathanhefner
Copy link
Member

This refactor avoids unnecessarily loading ActionController::Base when loading ActionMailer::Base.

Before:

$ bin/rails r 'Benchmark.memory { |x| x.report("load"){ ActionMailer::Base } }'
Calculating -------------------------------------
                load    10.013M memsize (     1.372M retained)
                        78.341k objects (    14.363k retained)
                        50.000  strings (    50.000  retained)

After:

$ bin/rails r 'Benchmark.memory { |x| x.report("load"){ ActionMailer::Base } }'
Calculating -------------------------------------
                load     5.043M memsize (   729.741k retained)
                        38.854k objects (     7.809k retained)
                        50.000  strings (    50.000  retained)

This refactor avoids unnecessarily loading `ActionController::Base` when
loading `ActionMailer::Base`.

Before:

```
$ bin/rails r 'Benchmark.memory { |x| x.report("load"){ ActionMailer::Base } }'
Calculating -------------------------------------
                load    10.013M memsize (     1.372M retained)
                        78.341k objects (    14.363k retained)
                        50.000  strings (    50.000  retained)
```

After:

```
$ bin/rails r 'Benchmark.memory { |x| x.report("load"){ ActionMailer::Base } }'
Calculating -------------------------------------
                load     5.043M memsize (   729.741k retained)
                        38.854k objects (     7.809k retained)
                        50.000  strings (    50.000  retained)
```
@jonathanhefner jonathanhefner changed the title Avoid ActionController on ActionMailer::Base load Avoid loading ActionController::Base when loading ActionMailer::Base May 20, 2022
@byroot
Copy link
Member

byroot commented May 21, 2022

So this this just moving the code from ActionController to AbstractController right? That makes sense to me.

@byroot byroot merged commit 7a15d15 into rails:main May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants