After profiling and optimizing a drupal site of mine, I came to the point where loading modules was taking by far the majority of the time needed to produce most of the pages.

I've started on what may or may not turn out to be a series of low-memory versions of core and contributed modules that I use. The idea is to get the modules to behave more along the lines of Károly's (abandoned?) "split mode" -- to have them load code when necessary, rather than loading all code on every page. While it would be great to see Drupal's core provide more structure for ensuring this kind of behavior (kind of like how there's now a separate .install file), it's still possible to significantly reduce module memory usage and load time within the current framework.

There are a few differences between this "project" and split mode. In particular, I'm trying:

  • to do this in a way that does not require changing drupal's core, but only the module being affected
  • to minimize file I/O and code loaded into memory, and thus leaving functions that get called on every page (like hook_menu(FALSE) and hook_help()) as they are
  • to group functions into the same file where it seems reasonable to do so

As a pilot of sorts, I've created a low memory version of the Drupal 5.2 system.module, and I may "release" more if there are enough people trying it out. I'd love feedback of any kind, either here (hopefully I get subscribed to this forum topic) or on that page

Comments

carlmcdade’s picture

I am marking this and going to give your module a good test run.

Hiveminds Magazine - for web publishers and community builders
http://www.hiveminds.co.uk
http://demo.hiveminds.co.uk
Drupal Support Wiki | Drupal Sverige

wuf31’s picture

Subscribing, so that i can come back later.
Let's do benchmark!

-=- Jhon -=-

toma’s picture

Subscribing
---
Biladi
http://www.biladi.ma

stephnie’s picture

Looking forward to it :) The need for speed

moshe weitzman’s picture

you are best off running your site where there is an opcode cache. that makes this all a moot point since files are parsed once and kept in cache.

note that in D6 we have a built in way for modules to slim themselves as you describe. se hook_menu changes.

Wesley Tanaka’s picture