Project:Event
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The event module is taking up almost a megabyte by itself on my site. Is it possible to reduce the footprint that gets loaded into memory, at least on pages that don't use the module?

Comments

#1

The problem is that you can't tell where the module is being used due to the blocks that are provided by it.

#2

The method I've been using in my own modules is to leave hook_menu, hook_block, hook_help, etc inline in the .module file, and copying all the other functions to a separate auxiliary file. All functions that need to be public remain defined in the .module file, but have a body like this:

function myfunc($arg1, &$arg2)
{
include_once dirname(__FILE__).'/mymodule.inc';
auxiliary_myfunc($arg1, $arg2);
}

If (for example) hook_block is big, and not called from every single page, I extract that body into its own separate file and include it using the method above.

#3

Well, I am not opposed to this. Send patches. :)

#4

Does that mean it will get committed? :)

#5

If it a) works and b) does not make the code too unreadable, why not?

#6

Previously event.module was using up 1622352 bytes on load. After this patch, it uses 243944 (initially) on load.

AttachmentSize
event-memory.zip 39.95 KB

#7

Status:active» needs review

#8

"If it a) works and b) does not make the code too unreadable, why not?"

If that's the criteria then I'll bring 40222 and #40720 to your attention.

#9

Status:needs review» needs work

Due to other patches being appled this wont apply anymore. Please don't attach zips.

#10

Status:needs work» fixed

I have changes event.module to not include event_timezones.inc on all page views. I guess that will fix most of this. I mark this fixed, but invite everybody to send more patches.

#11

Status:fixed» closed (fixed)