 modules/taxonomy/taxonomy.module |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git modules/taxonomy/taxonomy.module modules/taxonomy/taxonomy.module
index 70a9dd9..48bb808 100644
--- modules/taxonomy/taxonomy.module
+++ modules/taxonomy/taxonomy.module
@@ -406,6 +406,7 @@ function taxonomy_vocabulary_save($vocabulary) {
 
   cache_clear_all();
   entity_get_controller('taxonomy_vocabulary')->resetCache();
+  drupal_static_reset('taxonomy_vocabulary_get_names');
 
   return $status;
 }
@@ -749,7 +750,11 @@ function taxonomy_get_vocabularies() {
  *   An array of vocabulary ids, names, machine names, keyed by machine name.
  */
 function taxonomy_vocabulary_get_names() {
-  $names = db_query('SELECT name, machine_name, vid FROM {taxonomy_vocabulary}')->fetchAllAssoc('machine_name');
+  $names = &drupal_static(__FUNCTION__, array());
+  
+  if (empty($names)) {
+    $names = db_query('SELECT name, machine_name, vid FROM {taxonomy_vocabulary}')->fetchAllAssoc('machine_name');
+  }
   return $names;
 }
 
@@ -1098,8 +1103,12 @@ function taxonomy_vocabulary_load($vid) {
  *   Results are statically cached.
  */
 function taxonomy_vocabulary_machine_name_load($name) {
-  $vocabularies = taxonomy_vocabulary_load_multiple(NULL, array('machine_name' => $name));
-  return reset($vocabularies);
+  $names = taxonomy_vocabulary_get_names();
+  if (isset($names[$name])) {
+    // Convert $name to $vid in order to avoid automatic cache miss.
+    return taxonomy_vocabulary_load($names[$name]->vid);
+  }
+  return FALSE;
 }
 
 /**
