I have been looking at my APC cache, which regularly overflows even at 96MB, seeing if I can get rid of some modules. I noticed that, for me, Webform is third highest in storage used in the cache, at over 2.3MB, and is below only core common.inc and Views.

webform.module is about 147k characters. This is by far the largest .module in my sites/all/modules: views.module is the next biggest at 81k.

Would you consider factoring webform.module into more .inc files? My understanding is that for performance reasons, it's good to keep the .module files small, with the necessary hook implementations, and load the code you need only occasionally on demand.
.
I like and use Webform, but only in a small corner of our website. A large webform.module takes longer to load and occupies more cache. I could say the same thing about a number of other modules; Webform just stood out more than the rest at first glance. Thanks.

Comments

quicksketch’s picture

Hi @dhalbert, sorry this has taken awhile for me to get to this issue. I think you're right that the Webform module is too big. There's a ton of code in there that is only necessary some of the time. The biggest culprit being the Webform "client form" code. It's about 1300 lines of code that is only needed when rendering a Webform node's form.

However most of the module is actually already hooks, but sometimes it can be surprising how large they are (hook_menu() is over 300 lines for example). Perhaps what we should do is make a webform.hooks.inc file for the contents of the hooks too, and just include the file at the top of each hook function. Cutting out the hooks would be the really big win. They probably make up about 2000 lines of code in the module file itself. Then the only thing left would be hook function signatures and utility functions (which I feel probably should stay just because they're used frequently).

quicksketch’s picture

Issue summary: View changes

typo

danchadwick’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

I don't see effort being put into this at this point, given the 8.x efforts. Not enough reward for the effort.