--- select.inc.orig	2010-03-11 12:27:54.000000000 -0600
+++ select.inc	2010-03-11 15:45:18.000000000 -0600
@@ -552,7 +552,7 @@
     foreach (array_intersect_key($options, $rows) as $key => $label) {
       $ordered_rows[] = $rows[$key];
     }
-  
+
     // Add a row for any unknown or user-entered values.
     if ($component['extra']['other_option'] === 'Y') {
       $full_count = db_result(db_query($count_query, array_merge(array($component['nid'], $component['cid']), $sids)));
@@ -671,40 +671,51 @@
  *   Optional. Whether or not to filter returned values.
  */
 function _webform_select_options($text, $flat = FALSE, $filter = TRUE) {
-  $options = array();
-  $rows = array_filter(explode("\n", trim($text)));
-  $group = NULL;
-  foreach ($rows as $option) {
-    $option = trim($option);
-    /**
-     * If the Key of the option is within < >, treat as an optgroup
-     *
-     * <Group 1>
-     *   creates an optgroup with the label "Group 1"
-     *
-     * <>
-     *   Unsets the current group, allowing items to be inserted at the root element.
-     */
-
-    if (preg_match('/^\<([^>]*)\>$/', $option, $matches)) {
-      if (empty($matches[1])) {
-        unset($group);
-      }
-      elseif (!$flat) {
-        $group = $filter ? _webform_filter_values($matches[1], NULL, NULL, NULL, FALSE) : $matches[1];
-      }
-    }
-    elseif (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) {
-      $key = $filter ? _webform_filter_values($matches[1], NULL, NULL, NULL, FALSE) : $matches[1];
-      $value = $filter ? _webform_filter_values($matches[2], NULL, NULL, NULL, FALSE) : $matches[2];
-      isset($group) ? $options[$group][$key] = $value : $options[$key] = $value;
-    }
-    else {
-      $filtered_option = $filter ? _webform_filter_values($option, NULL, NULL, NULL, FALSE) : $option;
-      isset($group) ? $options[$group][$filtered_option] = $filtered_option : $options[$filtered_option] = $filtered_option;
+  /**
+   * We will keep each processed option block in an array indexed by the MD5 hash of
+   * the option text and the value of flat.
+   */
+  if (!is_array($option_cache)) {
+    static $option_cache = array();
+  }
+  $md5 = md5($text);
+  // Check if this option block has been previously processed.
+  if (!isset($option_cache[$md5][$flat])) {
+    $option_cache[$md5][$flat] = array();
+    $rows = array_filter(explode("\n", trim($text)));
+    $group = NULL;
+    foreach ($rows as $option) {
+      $option = trim($option);
+      /**
+       * If the Key of the option is within < >, treat as an optgroup
+       *
+       * <Group 1>
+       *   creates an optgroup with the label "Group 1"
+       *
+       * <>
+       *   Unsets the current group, allowing items to be inserted at the root element.
+       */
+      if (preg_match('/^\<([^>]*)\>$/', $option, $matches)) {
+        if (empty($matches[1])) {
+          unset($group);
+        }
+        elseif (!$flat) {
+          $group = $filter ? _webform_filter_values($matches[1], NULL, NULL, NULL, FALSE) : $matches[1];
+        }
+      }
+      elseif (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) {
+        $key = $filter ? _webform_filter_values($matches[1], NULL, NULL, NULL, FALSE) : $matches[1];
+        $value = $filter ? _webform_filter_values($matches[2], NULL, NULL, NULL, FALSE) : $matches[2];
+        isset($group) ? $option_cache[$md5][$flat][$group][$key] = $value : $option_cache[$md5][$flat][$key] = $value;
+      }
+      else {
+        $filtered_option = $filter ? _webform_filter_values($option, NULL, NULL, NULL, FALSE) : $option;
+        isset($group) ? $option_cache[$md5][$flat][$group][$filtered_option] = $filtered_option : $option_cache[$md5][$flat][$filtered_option] = $filtered_option;
+      }
     }
   }
-  return $options;
+  // Return our options from the option_cache array.
+  return $option_cache[$md5][$flat];
 }
 
 /**
