[development] Eliminate hooks entirely in Drupal 6

Gabor Hojtsy gabor at hojtsy.hu
Tue Jan 23 22:34:32 UTC 2007


On Tue, 23 Jan 2007, Earl Miles wrote:
> The $file would be a file that should live in the same directory as the 
> .module file and tells the system which file to conditionally load when that 
> callback is invoked. This is one of the things that creates a big advantage 
> in this system: We could move callbacks into conditionally loaded files, 
> allowing Drupal's minimum per-page codesize to be smaller. The 'nodeapi' hook 
> is not run for every page load, but because hooks are anonymous right now, 
> that code *must* be present.

Well, I am increasingly adopting a similar coding practice. A few days 
ago, I also split up archive.module into a small stub which registers the 
menu item and has a page callback, and then that page callback includes 
archive.inc which contains all the magic to display an archive page. This 
does eliminate a great deal of parsing for PHP. Although we use an opcode 
cache here, we observed greatly reduced memory usage if we take care of 
doing our own modules this way. (I don't have hard numbers unfortunately).

Gabor


More information about the development mailing list