Hi, thanks for the module, looking at the code there's a bit of a random 'include' statement at the very top of the .module file that looks like:
/**
* Include additional files.
*/
$dirname = dirname(__FILE__);
$includes = file_scan_directory($dirname . '/includes', '/.inc$/');
foreach (module_list() as $module) {
$file = $dirname . '/includes/' . $module . '.inc';
if (isset($includes[$file])) {
require_once $file;
}
}
This all boils down to:
require_once dirname(__FILE__) . '/includes/imageapi_optimize.inc';
The former code is massively detrimental for performance, we're hitting the disk, and searching a directory, when we know what file we're looking for. We could just replace the complicated code, with the simple code, but looking at the file, it's actually just a hook implementation, and an implementation of our own hook at that, so actually we could just implement hook_hook_info
and Drupal would include the file on demand, also other modules could then do this too.
Patch to follow...
Comment | File | Size | Author |
---|---|---|---|
#6 | imageapi_optimize-performance_issue_with-2613174-6.patch | 1.12 KB | Steven Jones |
#3 | imageapi_optimize-2613174-performance-include.patch | 3.49 KB | Steven Jones |
Comments
Comment #2
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedAdded the actual code snippets to the summary, doh!
Comment #3
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedHere's a patch that implements a hook_hook_info, and moves the code so it'll get picked up.
Comment #4
ttkaminski CreditAttribution: ttkaminski commentedNoticed that same thing when inspecting the code. Installed your patch and everything still seems to work.
Comment #6
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedHere's an updated patch.
Comment #8
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commented