Sep. 14th, 2007

giza: Giza White Mage (Default)
Earlier tonight, I was trying to figure out why a Drupal installation of mine was running kinda slow. So, I installed the awesome devel module and had it print out the list of database queries. What I found when going through the forums was on each post there were dozens and dozens of calls to drupal_lookup_path() for URLs which I never had (or will) make aliases of. Namely URLs that start with "comment/" or "user/".

So, I wrote a little patch for that function which will skip querying the database for URLs like that:

--- includes/path.inc   2007/09/14 00:06:12     1.1
+++ includes/path.inc   2007/09/14 00:15:21
@@ -44,6 +44,21 @@
   static $map = array(), $no_src = array();
   static $count;
 
+       //
+       // Drupal does an INSANE number of these queries for comment lnks
+       // and such on long threads, and that's just unacceptable.  Since
+       // I plan on like, never setting up a URL alias on a comment or 
+       // a user, I'm just going to stop here...
+       //
+       if (
+               stristr($path, "comment/")
+               || stristr($path, "user/")
+               ) {
+               return(false);
+       }
+
   // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
   if (!isset($count)) {
     $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));


You will see the most gain with forum posts that have many comments, but even on regular pages you should see some benefit. Enjoy!
giza: Giza White Mage (Default)
 
The career meme...
1. Go to Career Cruising, www.careercruising.com.
2. Put in Username: nycareers and Password: landmark.
3. Take their "Career Matchmaker" quiz.
4. Post the top twenty results.
5. Put the careers you have seriously considered in bold.
6. Italicize any that are part of your current job/career.

1. Avionics Tech
2. Small Engine Mechanic
3. Appliance Repairer
4. Motorcycle Mechanic
5. Diesel Mechanic
6. Automobile Mechanic
7. Aircraft Mechanic
8. Electronics Repairer
9. Industrial Machinery Mechanic
10. Millwright
11. Mechanical Engineering Tech
12. Office Machine Repairer
13. Race Car Mechanic
14. Locksmith
15. Mechanical Engineer
16. Aerospace Engineer
17. Stationary Engineer
18. Computer Support Person
19. Pilot
20. Nuclear Medicine Technologist



Wow... none of those things really relate to what I am doing now (computer programming) except for maybe #18, and even that one is a stretch.

Database Developer and Web Developer were #24 and #26 on my list though. Disc Jockey was #31, and Alcoholic Astronaut was #35...
giza: Giza White Mage (Default)
 

My father just got on Facebook.

Unbelievable.

This is the same guy who used to freak out when I used to belong to dozens of different BBSes at age 16.

Anyway, he can be found on Facebook as "Thomas Muth". If y'all want to friend him, feel free! He's at home recovering from ankle surgery, which means he has to be off his feet for a few months. I'm sure he could use interesting and creative ways to pass the time.

Profile

giza: Giza White Mage (Default)
Douglas Muth

April 2012

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags