Index: libutil/gtagsop.c
===================================================================
RCS file: /sources/global/global/libutil/gtagsop.c,v
retrieving revision 1.99
diff -u -p -r1.99 gtagsop.c
--- libutil/gtagsop.c	1 Dec 2006 14:19:27 -0000	1.99
+++ libutil/gtagsop.c	7 Dec 2006 05:58:29 -0000
@@ -22,6 +22,7 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include <sys/time.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -431,8 +432,10 @@ gtags_first(GTOP *gtop, const char *patt
 		char *p;
 		const char *cp;
 		unsigned long i;
+		struct timeval tv1,tv2,tvpool,tvsort;
 
-		gtop->pool = strhash_open(HASHBUCKETS);
+		p = getenv("BUCKET_SIZE_FOR_SORTING_PATH");
+		gtop->pool = strhash_open(p ? atoi(p) : HASHBUCKETS);
 		/*
 		 * Pool path names.
 		 *
@@ -442,6 +445,7 @@ gtags_first(GTOP *gtop, const char *patt
 		 * |105		./aaa/b.c
 		 *  ...
 		 */
+		gettimeofday(&tv1,NULL);
 		for (tagline = dbop_first(gtop->dbop, key, preg, dbflags);
 		     tagline != NULL;
 		     tagline = dbop_next(gtop->dbop))
@@ -460,6 +464,8 @@ gtags_first(GTOP *gtop, const char *patt
 				entry->value = strhash_strdup(gtop->pool, cp, 0);
 			}
 		}
+		gettimeofday(&tv2,NULL);
+		timersub(&tv2,&tv1,&tvpool);
 		/*
 		 * Sort path names.
 		 *
@@ -469,6 +475,7 @@ gtags_first(GTOP *gtop, const char *patt
 		 * |105		./aaa/b.c <-------* |
 		 *  ...				...
 		 */
+		gettimeofday(&tv1,NULL);
 		gtop->path_array = (char **)check_malloc(gtop->pool->entries * sizeof(char *));
 		i = 0;
 		for (entry = strhash_first(gtop->pool); entry != NULL; entry = strhash_next(gtop->pool))
@@ -476,6 +483,12 @@ gtags_first(GTOP *gtop, const char *patt
 		if (i != gtop->pool->entries)
 			die("Something is wrong. 'i = %lu, entries = %lu'" , i, gtop->pool->entries);
 		qsort(gtop->path_array, gtop->pool->entries, sizeof(char *), compare_path);
+		gettimeofday(&tv2,NULL);
+		timersub(&tv2,&tv1,&tvsort);
+
+		fprintf(stderr, "pool: %ld.%06lds sort: %ld.%06lds\n",
+			tvpool.tv_sec, tvpool.tv_usec, tvsort.tv_sec, tvsort.tv_usec);
+
 		gtop->path_count = gtop->pool->entries;
 		gtop->path_index = 0;
 
