[development] How many modules is too many?

Larry Garfield larry at garfieldtech.com
Thu Nov 22 18:45:48 UTC 2007


On Thursday 22 November 2007, Khalid Baheyeldin wrote:
> On Nov 22, 2007 4:41 AM, J-P Stacey <jp.stacey at torchbox.com> wrote:
> > Greg Holsclaw wrote:
> > > Drupal 6 will better optimize this issue by allowing module developers
> > > to better include only the needed files through the menu system, thus
> > > reducing overall memory usage without adding much overhead for opening
> > > more files. I am sure chx would give a better summary.
> >
> > I was just thinking, what might be nice, then, is for there to be some
> > standard way of componentizing a module, and bringing in bits of it based
> > on
> > the URL. I take it from the mention of menu that that's what D6 does?
>
> Module splitting has happened as part of D6, mostly along the lines of
> admin stuff and regular stuff. However, it can be further tuned to be more
> granular,
> but it has to be on a module by module basis. No general rule can work for
> all
> possible permutations.

What Drupal 6 does is allow hook_menu() and hook_theme() to specify an extra 
file to be loaded into memory before the page handler or theme function(s) 
are called.  The new theme system has also moved many to most theme functions 
off into template files, which has the double benefit of making them easier 
to theme as well as not being loaded unless actually required.  As of beta 3, 
all core modules have been split up with the exception of locale, which is 
already split in a somewhat bizarre way by putting all of its page handlers 
into locale.inc.  I'm not certain it's worth refactoring that when in beta 3 
stage, when there wouldn't be any significant difference in the amount of 
code that's loaded.  (Gabor, I defer to you on that one.)

I need to do some benchmarks to see just how much time we save this way, but 
based on earlier partial benchmarks I suspect it will be considerable.  Of 
course, it also is dependent on contrib authors taking advantage of this new 
functionality.  If you maintain a contrib module, *please* make sure to read 
this page:

http://drupal.org/node/146172

I am already working on a new system to take that process a step further in 
Drupal 7, but I don't want to get into details on the dev list when Drupal 6 
isn't even out yet.  If you want to hear about it, go test patches. :-)

-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson


More information about the development mailing list