diff --git a/taxonomynode.module b/taxonomynode.module
index 658ecc1..b82b45c 100644
--- a/taxonomynode.module
+++ b/taxonomynode.module
@@ -61,18 +61,23 @@ function _taxonomynode_get_tid_from_nid($nid) {
  *   Array of vocabularies ID, empty array if none
  */
 function _taxonomynode_node_get_vids($node) {
-  $vocabs = array();
-
-  // find if node is mapped to some vocabulary
-  $vocabularies = taxonomy_get_vocabularies();
-  foreach ($vocabularies as $vocab) {
-    $taxonomynode_settings = variable_get("taxonomynode_{$vocab->vid}", array());
-    if ($taxonomynode_settings['content_type'] == $node->type) {
-      $vocabs[] = $vocab->vid;
+  // Store the vids for each content type, so we only have to do this once per type
+  static $node_type_vids;
+  if (!isset($node_type_vids[$node->type])) {
+    $node_type_vids[$node->type] = array();
+    // Prevent this function from calling taxonomy_get_vocabularies multiple times
+    static $vocabularies;
+    if (!isset($vocabularies)) {
+      $vocabularies = taxonomy_get_vocabularies();
+    }
+    foreach ($vocabularies as $vocab) {
+      $taxonomynode_settings = variable_get("taxonomynode_{$vocab->vid}", array());
+      if ($taxonomynode_settings['content_type'] == $node->type) {
+        $node_type_vids[$node->type][] = $vocab->vid;
+      }
     }
   }
-
-  return $vocabs;
+  return $node_type_vids[$node->type];
 }
 
 function _taxonomynode_create_term($node) {
