Skip to content

Commit

Permalink
cii: Tuning bucket hint size of hash table
Browse files Browse the repository at this point in the history
  • Loading branch information
XuShaohua committed Nov 26, 2023
1 parent 6578d8f commit e0a2784
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cii/tests/wf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
Expand Down

0 comments on commit e0a2784

Please sign in to comment.