summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-02-24 12:09:59 +0000
committerDries Buytaert <dries@buytaert.net>2011-02-24 12:09:59 +0000
commit80aacdb000b36bf87185eda0de960086f31ae2fe (patch)
tree382a60b65d47cdb853dc7c26a5718c1727cd9924
parentb3094a0b7605dffa1e695ad72b3da04208a2d2a8 (diff)
downloadbrdo-80aacdb000b36bf87185eda0de960086f31ae2fe.tar.gz
brdo-80aacdb000b36bf87185eda0de960086f31ae2fe.tar.bz2
- Patch #1064212 by catch: page caching performance has regressed by 30-40%.
-rw-r--r--includes/cache.inc13
-rw-r--r--includes/module.inc3
-rw-r--r--modules/system/system.api.php2
3 files changed, 13 insertions, 5 deletions
diff --git a/includes/cache.inc b/includes/cache.inc
index 21630617d..2b150ffd9 100644
--- a/includes/cache.inc
+++ b/includes/cache.inc
@@ -325,10 +325,15 @@ class DrupalDatabaseCache implements DrupalCacheInterface {
try {
// Garbage collection necessary when enforcing a minimum cache lifetime.
$this->garbageCollection($this->bin);
- $query = db_select($this->bin);
- $query->fields($this->bin, array('cid', 'data', 'created', 'expire', 'serialized'));
- $query->condition($this->bin . '.cid', $cids, 'IN');
- $result = $query->execute();
+
+ // When serving cached pages, the overhead of using db_select() was found
+ // to add around 30% overhead to the request. Since $this->bin is a
+ // variable, this means the call to db_query() here uses a concatenated
+ // string. This is highly discouraged under any other circumstances, and
+ // is used here only due to the performance overhead we would incur
+ // otherwise. When serving an uncached page, the overhead of using
+ // db_select() is a much smaller proportion of the request.
+ $result = db_query('SELECT cid, data, created, expire, serialized FROM {' . db_escape_table($this->bin) . '} WHERE cid IN (:cids)', array(':cids' => $cids));
$cache = array();
foreach ($result as $item) {
$item = $this->prepareItem($item);
diff --git a/includes/module.inc b/includes/module.inc
index 14b394cc7..9807acd48 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -127,6 +127,9 @@ function system_list($type) {
// if not fetch only the required information to fire bootstrap hooks
// in case we are going to serve the page from cache.
if ($type == 'bootstrap') {
+ if (isset($lists['bootstrap'])) {
+ return $lists['bootstrap'];
+ }
if ($cached = cache_get('bootstrap_modules', 'cache_bootstrap')) {
$bootstrap_list = $cached->data;
}
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 92ca1e937..85e013824 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2552,7 +2552,7 @@ function hook_file_load($files) {
*
* @see file_validate()
*/
-function hook_file_validate(&$file) {
+function hook_file_validate($file) {
$errors = array();
if (empty($file->filename)) {