From: William A. Rowe Jr Date: Tue, 9 Oct 2001 02:41:47 +0000 (+0000) Subject: Speed it up. While this optimization wasn't obvious for the two-pass X-Git-Tag: 2.0.26~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f1c799241b5766c0bb8f977add85a16e23df982;p=thirdparty%2Fapache%2Fhttpd.git Speed it up. While this optimization wasn't obvious for the two-pass location_walk, it is significant for all subreq/redirects reusing the cached walk values. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91378 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/request.c b/server/request.c index 1cdaaa257ca..4f43a5dc29f 100644 --- a/server/request.c +++ b/server/request.c @@ -502,8 +502,13 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) * Otherwise (as is the case with most dir_merged/file_merged requests) * we must merge our dir_conf_merged onto this new r->per_dir_config. */ - if (cache->per_dir_result == r->per_dir_config) + if (r->per_dir_config == cache->per_dir_result) { return OK; + } + if (r->per_dir_config == cache->dir_conf_merged) { + r->per_dir_config = cache->per_dir_result; + return OK; + } if (cache->walked->nelts) now_merged = ((walk_walked_t*)cache->walked->elts) [cache->walked->nelts - 1].merged; @@ -914,6 +919,7 @@ minimerge2: cache->cached = ap_make_dirstr_parent(r->pool, r->filename); cache->dir_conf_tested = sec_ent; + cache->dir_conf_merged = r->per_dir_config; /* Merge our cache->dir_conf_merged construct with the r->per_dir_configs, * and note the end result to (potentially) skip this step next time. @@ -973,8 +979,13 @@ AP_DECLARE(int) ap_location_walk(request_rec *r) * Otherwise (as is the case with most dir_merged/file_merged requests) * we must merge our dir_conf_merged onto this new r->per_dir_config. */ - if (cache->per_dir_result == r->per_dir_config) + if (r->per_dir_config == cache->per_dir_result) { return OK; + } + if (r->per_dir_config == cache->dir_conf_merged) { + r->per_dir_config = cache->per_dir_result; + return OK; + } if (cache->walked->nelts) now_merged = ((walk_walked_t*)cache->walked->elts) [cache->walked->nelts - 1].merged; @@ -987,7 +998,6 @@ AP_DECLARE(int) ap_location_walk(request_rec *r) int matches = cache->walked->nelts; walk_walked_t *last_walk = (walk_walked_t*)cache->walked->elts; cache->cached = entry_uri; - cache->dir_conf_tested = sec_ent; /* Go through the location entries, and check for matches. * We apply the directive sections in given order, we should @@ -1051,6 +1061,9 @@ AP_DECLARE(int) ap_location_walk(request_rec *r) cache->walked->nelts -= matches; } + cache->dir_conf_tested = sec_ent; + cache->dir_conf_merged = r->per_dir_config; + /* Merge our cache->dir_conf_merged construct with the r->per_dir_configs, * and note the end result to (potentially) skip this step next time. */ @@ -1113,8 +1126,13 @@ AP_DECLARE(int) ap_file_walk(request_rec *r) * Otherwise (as is the case with most dir_merged requests) * we must merge our dir_conf_merged onto this new r->per_dir_config. */ - if (cache->per_dir_result == r->per_dir_config) + if (r->per_dir_config == cache->per_dir_result) { + return OK; + } + if (r->per_dir_config == cache->dir_conf_merged) { + r->per_dir_config = cache->per_dir_result; return OK; + } if (cache->walked->nelts) now_merged = ((walk_walked_t*)cache->walked->elts) [cache->walked->nelts - 1].merged; @@ -1127,7 +1145,6 @@ AP_DECLARE(int) ap_file_walk(request_rec *r) int matches = cache->walked->nelts; walk_walked_t *last_walk = (walk_walked_t*)cache->walked->elts; cache->cached = test_file; - cache->dir_conf_tested = sec_ent; /* Go through the location entries, and check for matches. * We apply the directive sections in given order, we should @@ -1180,6 +1197,9 @@ AP_DECLARE(int) ap_file_walk(request_rec *r) cache->walked->nelts -= matches; } + cache->dir_conf_tested = sec_ent; + cache->dir_conf_merged = r->per_dir_config; + /* Merge our cache->dir_conf_merged construct with the r->per_dir_configs, * and note the end result to (potentially) skip this step next time. */