From e0a2784f5caa31d413d0a94ed88e2b259641ce0b Mon Sep 17 00:00:00 2001 From: Xu Shaohua Date: Sun, 26 Nov 2023 18:37:13 +0800 Subject: [PATCH] cii: Tuning bucket hint size of hash table --- cii/tests/wf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cii/tests/wf.c b/cii/tests/wf.c index acf3fa1a..c6586226 100644 --- a/cii/tests/wf.c +++ b/cii/tests/wf.c @@ -31,7 +31,7 @@ void wf(const char* filename, FILE* fp) { const size_t kBufLen = 128; char buf[kBufLen]; - table_t* table = table_new(0, NULL, NULL); + table_t* table = table_new(32768, NULL, NULL); assert(table != NULL); while (get_word(fp, buf, kBufLen, first, rest)) { @@ -58,9 +58,9 @@ void wf(const char* filename, FILE* fp) { assert(array != NULL); qsort(array, table_length(table), 2 * sizeof(*array), compare); for (int i = 0; array[i] != NULL; i += 2) { - printf("%d\t%s\n", - *(int*) array[i+1], - (char*) array[i]); + printf("%s: %d\n", + (char*) array[i], + *(int*) array[i+1]); } FREE(array); }