about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2014-02-28 17:12:02 -0800
committerPaul Pluzhnikov <ppluzhnikov@google.com>2014-02-28 17:12:02 -0800
commit3fae2a38f853f386c25faf532dd12fc9044aab9d (patch)
tree6e5dc805da8f295e5466f616311d753f394725e1
parentcdaac281f27353c231ceafc4ea38fbf201186740 (diff)
downloadglibc-3fae2a38f853f386c25faf532dd12fc9044aab9d.tar.gz
glibc-3fae2a38f853f386c25faf532dd12fc9044aab9d.tar.xz
glibc-3fae2a38f853f386c25faf532dd12fc9044aab9d.zip
Reduce starting table sizes for locale-archive file, since we use only a small fraction of the entries.
-rw-r--r--README.google6
-rw-r--r--locale/programs/locarchive.c16
2 files changed, 18 insertions, 4 deletions
diff --git a/README.google b/README.google
index 78cca4cdbc..300cab9cd2 100644
--- a/README.google
+++ b/README.google
@@ -120,3 +120,9 @@ include/alloca.h
   Forward-ported from cl/51331379 (from cl/38559-p2).
   (ppluzhnikov, google-local) 
 
+locale/programs/locarchive.c
+  Reduce starting table sizes for locale-archive file, since we use only a
+  small fraction of the entries.
+  Forward-ported from cl/51331729 (from cl/39296-p2).
+  (cgd, google-local)
+
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index cdd99602c2..2d261d1ec5 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -67,12 +67,20 @@ static const char *locnames[] =
 #undef  DEFINE_CATEGORY
   };
 
+/* Google local change: we've reduced the initial archive header
+   sizes, since we use very few of the entries.  This saves ~100k.
 
+   The hash tables are sized larger than the number of entries we use.
+   The code will round their sizes up to the next power of 2, and if
+   it finds that they're >75% full will grow them as well.  We set the
+   defaults to the size that we'll end up with given what we use.
+
+   The vectors are sized exactly to hold what we use.  */
 /* Size of the initial archive header.  */
-#define INITIAL_NUM_NAMES	900
-#define INITIAL_SIZE_STRINGS	7500
-#define INITIAL_NUM_LOCREC	420
-#define INITIAL_NUM_SUMS	2000
+#define INITIAL_NUM_NAMES	5    /* (hash table of structs)  We use 3. */
+#define INITIAL_SIZE_STRINGS	32   /* (vector of bytes)        We use 32.  */
+#define INITIAL_NUM_LOCREC	2    /* (vector of structs)      We use 2.  */
+#define INITIAL_NUM_SUMS	11   /* (hash table of structs)  We use 6.  */
 
 
 /* Get and set values (possibly endian-swapped) in structures mapped