Forum: Ruby on Rails Two Controllers vs One Big Controller with many actions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0cfed8578fdd30c896da1e810bd34df9?d=identicon&s=25 virgild (Guest)
on 2005-11-18 16:09
(Received via mailing list)
I have two controllers with about 12 actions each, and since the two are
very closely related, I'm trying to merge them into just one controller.
What is the effect of this in terms of performance? I'm really not
trying to
do some deep optimization here, just want to find out if it will matter
in
case performance becomes an issue later.
E555e7c34196967444a47a96395a23ab?d=identicon&s=25 skaes (Guest)
on 2005-11-18 16:24
(Received via mailing list)
Vurg wrote:

>I have two controllers with about 12 actions each, and since the two are
>very closely related, I'm trying to merge them into just one controller.
>What is the effect of this in terms of performance? I'm really not trying to
>do some deep optimization here, just want to find out if it will matter in
>case performance becomes an issue later.
>
>
There will probably be no noticable speed difference, unless both have
differing filter needs. Potentially you could end up with twice as many
filters, or complicated :exclude, :include filter conditions. This could
slow  your app down a bit.

-- stefan kaes

PS: http://railsexpress.de/blog talks about Rails performance issues.
Subscribe ;-)
0cfed8578fdd30c896da1e810bd34df9?d=identicon&s=25 virgild (Guest)
on 2005-11-20 22:19
(Received via mailing list)
I'll take note of that.

Another thing that comes to my mind is a bigger controller class will be
slower to instantiate than one with less methods. But I'm not sure about
this yet.


"Stefan Kaes" <skaes@gmx.net> wrote in message
news:437DF186.9030003@gmx.net...
41e1579600683eed6c00af9a425268e6?d=identicon&s=25 epfrederick (Guest)
on 2005-11-20 22:35
(Received via mailing list)
Methods don't matter in regards to instantiation as most OO
languages--e.g. Java--implement instances in a 'flyweight' fashion.

To be clearer, non-static (or in ruby, non-class) methods are really
just static methods (from an implementation perspective) with an
associated context (instance variable values).

That being said, I'm not sure Ruby does this--although I would be
surprised to hear otherwise.

I don't think merging things for performance reasons makes sense (even
if it did lead to slightly better performance, which it probably
wont). I'd recommend keeping semantics as the primary driver for
collocating stuff, as hardware is so much cheaper than manpower these
days.
This topic is locked and can not be replied to.