Index: backends/markup-tree.c
===================================================================
--- backends/markup-tree.c	(revision 2753)
+++ backends/markup-tree.c	(working copy)
@@ -3660,7 +3660,7 @@
  * Save
  */
 
-#define INDENT_SPACES 8
+#define INDENT_SPACES 1
 
 static gboolean write_list_children   (GConfValue  *value,
                                        FILE        *f,
@@ -3674,6 +3674,32 @@
                                        GSList      *local_schemas,
                                        gboolean     save_as_subtree);
 
+/* the common case - before we start interning */
+static const char *write_indents_static[] = {
+  "", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", /* 5 */
+  "\t\t\t\t\t\t", "\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", /* 8 */
+  "\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t",         /* 10 */
+  "\t\t\t\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t\t\t\t", /* 12 */
+  "\t\t\t\t\t\t\t\t\t\t\t\t\t",
+  "\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
+  "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
+  "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",                   /* 16 */
+};
+
+static const char *make_whitespace (int indent)
+{
+  char *str, *p;
+
+  if (G_LIKELY (indent < G_N_ELEMENTS (write_indents_static)))
+    return write_indents_static [indent];
+
+  str = g_alloca (indent + 1);
+  for (p = str; indent; p++, indent--)
+    *p = '\t';
+  *p = '\0';
+  return g_intern_string (str);
+}
+
 static gboolean
 write_value_element (GConfValue *value,
                      const char *closing_element,
@@ -3682,8 +3708,6 @@
                      GSList     *local_schemas,
                      gboolean    save_as_subtree)
 {
-  char *whitespace;
-
   /* We are at the "<foo bar="whatever"" stage here,
    * <foo> still missing the closing >
    */
@@ -3811,17 +3835,12 @@
         
         s = g_markup_escape_text (gconf_value_get_string (value),
                                   -1);
-	whitespace = g_strnfill (indent + INDENT_SPACES, ' ');
-        
         if (fprintf (f, "%s<stringvalue>%s</stringvalue>\n",
-                     whitespace, s) < 0)
+                     make_whitespace (indent + INDENT_SPACES), s) < 0)
           {
-	    g_free (whitespace);
             g_free (s);
             return FALSE;
           }
-        
-	g_free (whitespace);
         g_free (s);
       }
       break;
@@ -3852,13 +3871,8 @@
       break;
     }
 
-  whitespace =  g_strnfill (indent, ' ');
-  if (fprintf (f, "%s</%s>\n", whitespace, closing_element) < 0)
-    {
-      g_free (whitespace);
-      return FALSE;
-    }
-  g_free (whitespace);
+  if (fprintf (f, "%s</%s>\n", make_whitespace (indent), closing_element) < 0)
+    return FALSE;
 
   return TRUE;
 }    
@@ -3870,16 +3884,13 @@
 {
   GSList *tmp;
   gboolean retval = FALSE;
-  char *whitespace;
 
-  whitespace = g_strnfill (indent, ' ');
-
   tmp = gconf_value_get_list (value);
   while (tmp != NULL)
     {
       GConfValue *li = tmp->data;
 
-      if (fputs (whitespace, f) < 0)
+      if (fputs (make_whitespace (indent), f) < 0)
 	goto out;
       
       if (fputs ("<li", f) < 0)
@@ -3895,8 +3906,6 @@
 
  out:
 
-  g_free (whitespace);
-
   return retval;
 }
 
@@ -3907,15 +3916,12 @@
 {
   GConfValue *child;
   gboolean retval = FALSE;
-  char *whitespace;
 
-  whitespace = g_strnfill (indent, ' ');
-  
   child = gconf_value_get_car (value);
 
   if (child != NULL)
     {
-      if (fputs (whitespace, f) < 0)
+      if (fputs (make_whitespace (indent), f) < 0)
 	goto out;
 
       if (fputs ("<car", f) < 0)
@@ -3929,7 +3935,7 @@
 
   if (child != NULL)
     {
-      if (fputs (whitespace, f) < 0)
+      if (fputs (make_whitespace (indent), f) < 0)
 	goto out;
       
       if (fputs ("<cdr", f) < 0)
@@ -3943,8 +3949,6 @@
  
  out:
 
-  g_free (whitespace);
-  
   return retval;
 }
 
@@ -3956,7 +3960,7 @@
                          gboolean         write_descs)
 {
   gboolean retval;
-  char *whitespace1, *whitespace2;
+  const char *whitespace1, *whitespace2;
   char *s;
 
   if (!write_descs && local_schema->default_value == NULL)
@@ -3964,8 +3968,8 @@
 
   retval = FALSE;
 
-  whitespace1 = g_strnfill (indent, ' ');
-  whitespace2 = g_strnfill (indent + INDENT_SPACES, ' ');
+  whitespace1 = make_whitespace (indent);
+  whitespace2 = make_whitespace (indent + INDENT_SPACES);
 
   if (fputs (whitespace1, f) < 0)
     goto out;
@@ -4050,9 +4054,6 @@
 
  out:
 
-  g_free (whitespace1);
-  g_free (whitespace2);
-
   return retval;
 }
 
@@ -4150,7 +4151,6 @@
 {
   LocalSchemaInfo *local_schema_info;
   gboolean         retval;
-  char            *whitespace;
 
   retval = FALSE;
   local_schema_info = NULL;
@@ -4169,11 +4169,9 @@
 	}
     }
 
-  whitespace = g_strnfill (indent, ' ');
-
   g_assert (entry->name != NULL);
   
-  if (fprintf (f, "%s<entry name=\"%s\"", whitespace, entry->name) < 0)
+  if (fprintf (f, "%s<entry name=\"%s\"", make_whitespace (indent), entry->name) < 0)
     goto out;
 
   if (local_schema_info == NULL)
@@ -4221,7 +4219,7 @@
                                     TRUE))
         goto out;
                                     
-      if (fprintf (f, "%s</entry>\n", whitespace) < 0)
+      if (fprintf (f, "%s</entry>\n", make_whitespace (indent)) < 0)
         goto out;
     }
 
@@ -4229,8 +4227,6 @@
 
  out:
 
-  g_free (whitespace);
-  
   return retval;
 }
 
@@ -4244,18 +4240,15 @@
 {
   GSList *tmp;
   gboolean retval = FALSE;
-  char *whitespace;
 
   dir->not_in_filesystem = TRUE;
 
   if (save_as_subtree && locale != NULL && dir->is_dir_empty)
     return TRUE;
 
-  whitespace = g_strnfill (indent, ' ');
-
   g_assert (dir->name != NULL);
   
-  if (fprintf (f, "%s<dir name=\"%s\">\n", whitespace, dir->name) < 0)
+  if (fprintf (f, "%s<dir name=\"%s\">\n", make_whitespace (indent), dir->name) < 0)
     goto out;
 
   tmp = dir->entries;
@@ -4290,15 +4283,13 @@
       tmp = tmp->next;
     }
 
-  if (fprintf (f, "%s</dir>\n", whitespace) < 0)
+  if (fprintf (f, "%s</dir>\n", make_whitespace (indent)) < 0)
     return FALSE;
 
   retval = TRUE;
 
  out:
 
-  g_free (whitespace);
-
   return retval;
 }
 
