p:This is a translated post of “http://www.trackself.com/archives/432.html” before i post it to drupal.org.
Because of my poor english , i will cut the crap.
using this method will reduce my site form 77 selects to 43 ,and copy the same method to taxonomy_get_term , will then reduce from 43 to 28 , if you’re using pathauto and path and a lot terms , it’s a lot more useful.
1.after using cacherouter and trun on drupal normal cache , my site still have 77 select per view when login.
2.using devel , i found a lot of drupal_lookup_path and taxonomy_get_term
3.learning from http://drupal.org/node/192448 and http://www.lullabot.com/articles/a_beginners_guide_to_caching_data , i use “PHP static “ plus “drupal cache_set” to reduce the selects.
4.locate include/path.inc , found :
$alias = db_result(db_query(.....", $path, $path_language));
change it to
http://www.trackself.com/code/drupal_get_path.txt
you should read the Chinese version here if you want to know clearer.