Download & Extend

Streamline drupal_bootstrap() and expose the flow to code profilers

Project:Drupal core
Version:7.x-dev
Component:base system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:Performance

Issue Summary

Spin-off from #615822-37: Benchmarking / profiling of D7:

This patch simply

1) moves the switch from _drupal_bootstrap() into drupal_bootstrap()

2) moves the code in larger switch cases into dedicated functions

The main purpose is to see the actual performance of every bootstrap phase. It was considered as a temporary patch, but I seriously don't see why it shouldn't be permanent. In fact, the flow of drupal_bootstrap() is much more grokable with this patch.

There is only one nitpick that is debatable: _drupal_bootstrap() had a static $cache; variable that was used both for DRUPAL_BOOTSTRAP_PAGE_CACHE and DRUPAL_BOOTSTRAP_PAGE_HEADER to figure out whether we need to send a X-Drupal-Cache: MISS HTTP header.

For now, I replaced that with a drupal_static(). An alternative would be to use a global variable. Yet another alternative would be to perhaps stuff that logic into drupal_page_is_cacheable().

AttachmentSizeStatusTest resultOperations
drupal.bootstrap-streamline.patch10.53 KBIdlePassed: 14608 passes, 0 fails, 0 exceptionsView details

Comments

#1

And this one solves the $cache variable issue.

AttachmentSizeStatusTest resultOperations
drupal.bootstrap-streamline.1.patch11.68 KBIdleFailed: 4842 passes, 2 fails, 0 exceptionsView details

#2

oopsie, small logic flaw ;) Now resembling 100% the same that was there before.

AttachmentSizeStatusTest resultOperations
drupal.bootstrap-streamline.2.patch11.71 KBIdlePassed: 14612 passes, 0 fails, 0 exceptionsView details

#3

Status:needs review» fixed

test bot would be very unhappy if you got this wrong. code looks good.

#4

Status:fixed» needs review

uhm, did you mean RTBC?

#5

Status:needs review» reviewed & tested by the community

Yes.

#6

bootstrap_unveiled.png

AttachmentSizeStatusTest resultOperations
bootstrap_unveiled.png170.99 KBIgnored: Check issue status.NoneNone

#7

And with context of the rest of the request (user/1 hitting /user).

AttachmentSizeStatusTest resultOperations
bootstrap_with_everything_else.png266.37 KBIgnored: Check issue status.NoneNone

#8

Status:reviewed & tested by the community» fixed

Nice clean-up, and helps us with profiling. Committed!

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here