Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.169
diff -u -p -r1.169 file.inc
--- includes/file.inc	24 May 2009 17:39:30 -0000	1.169
+++ includes/file.inc	26 May 2009 22:01:16 -0000
@@ -1527,8 +1527,13 @@ function file_upload_max_size() {
  *   The internet media type registered for the extension or application/octet-stream for unknown extensions.
  */
 function file_get_mimetype($filename, $mapping = NULL) {
+
+  // The mimetype of the favicon is checked on each request. Since iterating
+  // over every array item takes time, .ico is used as the first item of the
+  // mime_extension_mapping array.
   if (!is_array($mapping)) {
     $mapping = variable_get('mime_extension_mapping', array(
+      'ico' => 'image/vnd.microsoft.icon',
       'ez' => 'application/andrew-inset',
       'atom' => 'application/atom',
       'atomcat' => 'application/atomcat+xml',
@@ -1798,7 +1803,6 @@ function file_get_mimetype($filename, $m
       'cdr' => 'image/x-coreldraw',
       'pat' => 'image/x-coreldrawpattern',
       'cdt' => 'image/x-coreldrawtemplate',
-      'ico' => 'image/vnd.microsoft.icon',
       'art' => 'image/x-jg',
       'jng' => 'image/x-jng',
       'bmp' => 'image/x-ms-bmp',
@@ -1877,6 +1881,7 @@ function file_get_mimetype($filename, $m
       'xps' => 'application/vnd.ms-xpsdocument',
     ));
   }
+
   foreach ($mapping as $ext_preg => $mime_match) {
     if (preg_match('!\.(' . $ext_preg . ')$!i', $filename)) {
       return $mime_match;
@@ -1924,4 +1929,4 @@ function drupal_chmod($path, $mode = NUL
 
 /**
  * @} End of "defgroup file".
- */
\ No newline at end of file
+ */
