diff --git includes/common.inc includes/common.inc
index 8026209..fd45b81 100644
--- includes/common.inc
+++ includes/common.inc
@@ -3310,11 +3310,17 @@ function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_
  *
  * @param $class
  *   The class name to clean.
+ * @param $is_machine_name
+ *   If $class is known to only contain ASCII characters in the set 'a-z0-9_'
+ *   (i.e., lowercase letters, numbers, and underscore), then setting this to
+ *   TRUE results in faster execution. This can be used when calling this
+ *   function for a Drupal hook name, function name, database table or column
+ *   name, or the 'machine_name' of a Drupal object.
  * @return
  *   The cleaned class name.
  */
-function drupal_html_class($class) {
-  return drupal_clean_css_identifier(drupal_strtolower($class));
+function drupal_html_class($class, $is_machine_name = FALSE) {
+  return $is_machine_name ? strtr($class, '_', '-') : drupal_clean_css_identifier(drupal_strtolower($class));
 }
 
 /**
@@ -3372,7 +3378,7 @@ function drupal_html_id($id) {
  * @see template_preprocess_region()
  */
 function drupal_region_class($region) {
-  return drupal_html_class("region-$region");
+  return drupal_html_class("region-$region", TRUE);
 }
 
 /**
diff --git includes/theme.inc includes/theme.inc
index f2b091f..181faf4 100644
--- includes/theme.inc
+++ includes/theme.inc
@@ -2155,7 +2155,7 @@ function template_preprocess(&$variables, $hook) {
   $variables['directory'] = path_to_theme();
 
   // Initialize html class attribute for the current hook.
-  $variables['classes_array'] = array(drupal_html_class($hook));
+  $variables['classes_array'] = array(drupal_html_class($hook, TRUE));
 
   // Merge in variables that don't depend on hook and don't change during a
   // single page request.
@@ -2264,7 +2264,7 @@ function template_preprocess_html(&$variables) {
 
   // If on an individual node page, add the node type to body classes.
   if ($node = menu_get_object()) {
-    $variables['classes_array'][] = drupal_html_class('node-type-' . $node->type);
+    $variables['classes_array'][] = drupal_html_class('node-type-' . $node->type, TRUE);
   }
 
   // RDFa allows annotation of XHTML pages with RDF data, while GRDDL provides
diff --git modules/block/block.module modules/block/block.module
index c672c63..8c6f58b 100644
--- modules/block/block.module
+++ modules/block/block.module
@@ -844,7 +844,7 @@ function template_preprocess_block(&$variables) {
   // Create the $content variable that templates expect.
   $variables['content'] = $variables['elements']['#children'];
 
-  $variables['classes_array'][] = drupal_html_class('block-' . $variables['block']->module);
+  $variables['classes_array'][] = drupal_html_class('block-' . $variables['block']->module, TRUE);
 
   $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region;
   $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module;
diff --git modules/field/field.module modules/field/field.module
index 5d9c159..4a87e93 100644
--- modules/field/field.module
+++ modules/field/field.module
@@ -745,11 +745,9 @@ function template_preprocess_field(&$variables, $hook) {
     }
   }
 
-  // Add default CSS classes. Since there can be many fields rendered on a page,
-  // save some overhead by calling strtr() directly instead of
-  // drupal_html_class().
-  $variables['field_name_css'] = strtr($element['#field_name'], '_', '-');
-  $variables['field_type_css'] = strtr($element['#field_type'], '_', '-');
+  // Add default CSS classes.
+  $variables['field_name_css'] = drupal_html_class($element['#field_name'], TRUE);
+  $variables['field_type_css'] = drupal_html_class($element['#field_type'], TRUE);
   $variables['classes_array'] = array(
     'field',
     'field-name-' . $variables['field_name_css'],
diff --git modules/node/node.module modules/node/node.module
index 7668f32..adcb47a 100644
--- modules/node/node.module
+++ modules/node/node.module
@@ -1370,7 +1370,7 @@ function template_preprocess_node(&$variables) {
   }
 
   // Gather node classes.
-  $variables['classes_array'][] = drupal_html_class('node-' . $node->type);
+  $variables['classes_array'][] = drupal_html_class('node-' . $node->type, TRUE);
   if ($variables['promote']) {
     $variables['classes_array'][] = 'node-promoted';
   }
diff --git modules/simpletest/tests/common.test modules/simpletest/tests/common.test
index 089d07c..15085a5 100644
--- modules/simpletest/tests/common.test
+++ modules/simpletest/tests/common.test
@@ -728,6 +728,8 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
   function testDrupalHTMLClass() {
     // Verify Drupal coding standards are enforced.
     $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', t('Enforce Drupal coding standards.'));
+    // Verify the is_machine_name parameter only replaces underscores.
+    $this->assertIdentical(drupal_html_class('machine_name not!_mächine_name', TRUE), 'machine-name not!-mächine-name', t('Verify is_machine_name parameter is fast.'));
   }
 
   /**
