Statically cache drupal_is_front_page()

sun - September 25, 2008 - 02:14
Project:Drupal
Version:7.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

drupal_is_front_page() can be called many times for one page request.

AttachmentSizeStatusTest resultOperations
drupal.cache-front.patch1.01 KBIgnoredNoneNone

#1

Jaza - September 25, 2008 - 02:27

Benchmarks?

#2

sun - September 25, 2008 - 02:44

Before:

Document Path:          /
Document Length:        5435 bytes

Concurrency Level:      10
Time taken for tests:   91.954940 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      591800 bytes
HTML transferred:       543500 bytes
Requests per second:    1.09 [#/sec] (mean)
Time per request:       9195.494 [ms] (mean)
Time per request:       919.549 [ms] (mean, across all concurrent requests)
Transfer rate:          6.27 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   12   8.9     15      46
Processing:  4967 9014 1389.8   8919   13277
Waiting:     4967 9013 1389.7   8919   13277
Total:       4982 9026 1387.8   8950   13277

Percentage of the requests served within a certain time (ms)
  50%   8950
  66%   9168
  75%   9356
  80%   9590
  90%  10262
  95%  12730
  98%  12995
  99%  13277
100%  13277 (longest request)

After:

Document Path:          /
Document Length:        5435 bytes

Concurrency Level:      10
Time taken for tests:   90.799060 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      591800 bytes
HTML transferred:       543500 bytes
Requests per second:    1.10 [#/sec] (mean)
Time per request:       9079.906 [ms] (mean)
Time per request:       907.991 [ms] (mean, across all concurrent requests)
Transfer rate:          6.35 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   10   7.5     15      31
Processing:  4124 8892 1432.3   8669   11949
Waiting:     4123 8891 1432.2   8669   11949
Total:       4139 8903 1432.1   8684   11964

Percentage of the requests served within a certain time (ms)
  50%   8684
  66%   8950
  75%   9621
  80%  10012
  90%  11043
  95%  11699
  98%  11855
  99%  11964
100%  11964 (longest request)

#3

Rob Loach - September 25, 2008 - 04:40
Status:needs review» reviewed & tested by the community

Although this is good, I would much rather have #254491: Standardize static caching. Maybe postpone this until static cache factory goes in?

#4

earnie - September 25, 2008 - 13:58
Status:reviewed & tested by the community» postponed

I'm all for saving a query but what if the admin changes the front page? As Rob suggests lets postpone for #254491: Standardize static caching.

#5

Dave Reid - December 6, 2008 - 18:09
Status:postponed» duplicate

Wow, I'm really sorry I didn't see this issue first. I'm going to (sheepishly) mark this as a duplicate since there is a test included in #340557: Use static-cached variable for drupal_is_front_page().

 
 

Drupal is a registered trademark of Dries Buytaert.