[drupal-devel] Wrap every function call in module_invoke

Karoly Negyesi karoly at negyesi.net
Fri Apr 29 00:53:03 UTC 2005


I put split.php into my sandbox (contributions/sandbox/chx/) which wraps 
every module-defined function call for all modules in m(). It's a bit 
rough, mkdir calls are missing, but for testing it's OK. Drop it into your 
Drupal installation directory, create files/modules and let it go.

I have copied module_invoke and named it m() -- if someone needs, I can roll 
a patch ;)

I have tried a little ab and I have measured about 3% percent of performance 
Time per request:       5846.368 [ms] (mean)
Time per request:       1169.274 [ms] (mean, across all concurrent requests)
Time per request:       6033.208 [ms] (mean)
Time per request:       1206.642 [ms] (mean, across all concurrent requests)

However, I think it worths it. As some of you know, I am planning to 
introduce a "split" mode so only those functions are loaded which are 
called. This will surely cure memory limit problems. I do not yet know 
about peformance -- we'll have a lot of small .inc files which needs to be 
read instead of a few huges one, but the total amount of read is a lot 
smaller and the parsing will be lot less. We shall see.

Second, if we want to, we can be _real_ modular after this: every function 
can be "overwritten" this way if we define say 
module_overwrites_originalfunctionname to be an overwrite of 
originalfunctionname and get module_invoke to the overwrite.

If we think it does not worth it then it could be a contrib project after 

More information about the drupal-devel mailing list