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().

Comments

sun’s picture

StatusFileSize
new11.68 KB

And this one solves the $cache variable issue.

sun’s picture

StatusFileSize
new11.71 KB

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

moshe weitzman’s picture

Status: Needs review » Fixed

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

sun’s picture

Status: Fixed » Needs review

uhm, did you mean RTBC?

chx’s picture

Status: Needs review » Reviewed & tested by the community

Yes.

catch’s picture

StatusFileSize
new170.99 KB

bootstrap_unveiled.png

catch’s picture

StatusFileSize
new266.37 KB

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

dries’s picture

Status: Reviewed & tested by the community » Fixed

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

Status: Fixed » Closed (fixed)
Issue tags: -Performance

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