Need a list of terms from a vocabulary machine name
What you are doing is pretty much the same as Drupal core is doing for the term reference field, so doubt you can improve the code much.

/**
 * Returns the set of valid terms for a taxonomy field.
 *
 * @param $field
 *   The field definition.
 * @return
 *   The array of valid terms for this field, keyed by term id.
 */
function taxonomy_allowed_values($field) {
  $options = array();
  foreach ($field['settings']['allowed_values'] as $tree) {
    if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
      if ($terms = taxonomy_get_tree($vocabulary-&gt;vid, $tree['parent'])) {
        foreach ($terms as $term) {
          $options[$term-&gt;tid] = str_repeat('-', $term-&gt;depth) . $term-&gt;name;
        }
      }
    }
  }
  return $options;
}