Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.536
diff -u -p -r1.536 taxonomy.module
--- modules/taxonomy/taxonomy.module	8 Nov 2009 11:19:02 -0000	1.536
+++ modules/taxonomy/taxonomy.module	29 Jan 2010 15:01:59 -0000
@@ -664,6 +664,14 @@ function taxonomy_get_tree($vid, $parent
 
   $depth++;
 
+  // If the function is being called with default arguments see if a
+  // cached copy exsists.
+  if ($parent == 0 && $max_depth == NULL && $depth == -1) {
+    if ($cached_tree = cache_get('taxonomy_get_tree_' . $vid)) {
+      return $cached_tree;
+    }
+  }  
+
   // We cache trees, so it's not CPU-intensive to call get_tree() on a term
   // and its children, too.
   if (!isset($children[$vid])) {
@@ -705,6 +713,11 @@ function taxonomy_get_tree($vid, $parent
     }
   }
 
+  // If at the top level cache the taxonomy tree.
+  if ($parent == 0 && $max_depth == NULL && $depth == 0) {
+    cache_set('taxonomy_get_tree_' . $vid,$tree);
+  }  
+
   return $tree;
 }
