ruby on rails - Does using multiple ActionMailer classes increase memory overhead? -
i'm using 2 mailer classes in rails 3.2 app. 1 adminmailer, dedicated sending emails internal team, , 1 usermailer send emails our registered users.
usermailer beginning feel bloated, 35 methods (i.e. 35 different emails) in , counting. take subset of these emails fit under theme, , extract them out third mailer class make code more manageable , readable.
my question is: introduce more memory overhead on app need instantiate more mailer classes?
i tried searching on google & stack overflow didn't seem find on topic. thanks!
every request in rails initialises ~50k objects. 1 class more or less doesn't not make difference. instance basecamp3 has on 40 mailers (source: https://twitter.com/dhh/status/656905137898786816).
splitting mailers many classes make easier test (single responsibility, less stubbing/mocking).
don't worry, split them many classes! won't affect performance. of 'waiting time' in rails comes database interaction. optimising ruby code in cases micro-improvmenet comparing database operations time
Comments
Post a Comment