Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
book.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Aug 2007 at 19:46 UTC
Updated:
21 Aug 2007 at 12:03 UTC
Jump to comment: Most recent file
The new "all books" version of the book block can have its performance improved because it calls menu_tree_page_data() for every book even though we can determine that at most one of the books will correspond to the current page. For all the other books, we already have all the data we need from book_get_books(0 to build the single-link menu that will come back from menu_tree_page_data() (after 2 uneeded queries).
Attached patch gives the idea, but untested.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | book_block_perform_3.patch | 3.13 KB | pwolanin |
| #1 | book_block_perform_2.patch | 3.06 KB | pwolanin |
| book_block_perform_1.patch | 2.89 KB | pwolanin |
Comments
Comment #1
pwolanin commentedimproved - fixed parse error and notice.
Comment #2
pwolanin commentedInitial testing - this seems to work fine.
Comment #3
pwolanin commentedper suggestion by webernet and standard Drupal coding standards - moved a code comment to its own line. No other changes.
Comment #4
webernet commentedTested OK - doesn't seem to break anything.
Comment #5
flk commentedtested ok, performance improvement in regards to making menu_tree_all_data call for one book only at a time (the one that corresponds to current page)
Comment #6
gábor hojtsyI have not tested the code, but looking at the code, this line would drop an E_NOTICE error, if not on a node page:
Comment #7
pwolanin commented@Gabor - I think you are not correct about this - the use of empty() avoids any such notice. This code has been tested on non-node pages, of course.
Comment #8
gábor hojtsyIndeed, I was mistaken. Overlooked that simple check.
Thanks for the patch, committed!
Comment #9
(not verified) commented