]> git.ozlabs.org Git - ccan/commitdiff
htable: tools: use tal instead of talloc.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 10 Jun 2014 05:04:46 +0000 (14:34 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 10 Jun 2014 05:04:46 +0000 (14:34 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/htable/tools/Makefile
ccan/htable/tools/hsearchspeed.c
ccan/htable/tools/speed.c
ccan/htable/tools/stringspeed.c

index a21c51cb55ea12819a050984dc2d35feeaf89406..a2cad59f0c2dd7e2edf17fd290d89c7a0112e522 100644 (file)
@@ -1,20 +1,40 @@
-CFLAGS=-Wall -Werror -O3 -I../../..
-#CFLAGS=-Wall -Werror -g -I../../..
+CCANDIR=../../..
+CFLAGS=-Wall -Werror -O3 -I$(CCANDIR)
+#CFLAGS=-Wall -Werror -g -I$(CCANDIR)
+
+CCAN_OBJS:=ccan-tal.o ccan-tal-str.o ccan-tal-grab_file.o ccan-take.o ccan-time.o ccan-str.o ccan-noerr.o ccan-list.o
 
 all: speed stringspeed hsearchspeed
 
 
 all: speed stringspeed hsearchspeed
 
-speed: speed.o hash.o
+speed: speed.o hash.o $(CCAN_OBJS)
 
 speed.o: speed.c ../htable.h ../htable.c
 
 hash.o: ../../hash/hash.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
 
 speed.o: speed.c ../htable.h ../htable.c
 
 hash.o: ../../hash/hash.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
-stringspeed: stringspeed.o hash.o ../../talloc.o ../../str_talloc.o ../../grab_file.o ../../str.o ../../time.o ../../noerr.o
+stringspeed: stringspeed.o hash.o $(CCAN_OBJS)
 
 stringspeed.o: speed.c ../htable.h ../htable.c
 
 
 stringspeed.o: speed.c ../htable.h ../htable.c
 
-hsearchspeed: hsearchspeed.o ../../talloc.o ../../str_talloc.o ../../grab_file.o ../../str.o ../../time.o ../../noerr.o
+hsearchspeed: hsearchspeed.o $(CCAN_OBJS)
 
 clean:
        rm -f stringspeed speed hsearchspeed *.o
 
 clean:
        rm -f stringspeed speed hsearchspeed *.o
+
+ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-tal-str.o: $(CCANDIR)/ccan/tal/str/str.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-take.o: $(CCANDIR)/ccan/take/take.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-tal-grab_file.o: $(CCANDIR)/ccan/tal/grab_file/grab_file.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-time.o: $(CCANDIR)/ccan/time/time.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-list.o: $(CCANDIR)/ccan/list/list.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-str.o: $(CCANDIR)/ccan/str/str.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+ccan-noerr.o: $(CCANDIR)/ccan/noerr/noerr.c
+       $(CC) $(CFLAGS) -c -o $@ $<
index ea1a3f5c4e83960ea057087a8035075bb9bee750..6a8c62fc10676e5ddfb35482599ec6541bb4e2ba 100644 (file)
@@ -1,9 +1,9 @@
 /* Simple speed tests for a hash of strings using hsearch */
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
 /* Simple speed tests for a hash of strings using hsearch */
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
-#include <ccan/str_talloc/str_talloc.h>
-#include <ccan/grab_file/grab_file.h>
-#include <ccan/talloc/talloc.h>
+#include <ccan/tal/str/str.h>
+#include <ccan/tal/grab_file/grab_file.h>
+#include <ccan/tal/tal.h>
 #include <ccan/hash/hash.h>
 #include <ccan/time/time.h>
 #include <stdio.h>
 #include <ccan/hash/hash.h>
 #include <ccan/time/time.h>
 #include <stdio.h>
 #include <search.h>
 
 /* Nanoseconds per operation */
 #include <search.h>
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timeval *start,
-                       const struct timeval *stop,
+static size_t normalize(const struct timespec *start,
+                       const struct timespec *stop,
                        unsigned int num)
 {
                        unsigned int num)
 {
-       struct timeval diff;
-
-       timersub(stop, start, &diff);
-
-       /* Floating point is more accurate here. */
-       return (double)(diff.tv_sec * 1000000 + diff.tv_usec)
-               / num * 1000;
+       return time_to_nsec(time_divide(time_sub(*stop, *start), num));
 }
 
 int main(int argc, char *argv[])
 {
        size_t i, j, num;
 }
 
 int main(int argc, char *argv[])
 {
        size_t i, j, num;
-       struct timeval start, stop;
+       struct timespec start, stop;
        char **w;
        ENTRY *words, *misswords;
 
        char **w;
        ENTRY *words, *misswords;
 
-       w = strsplit(NULL, grab_file(NULL,
-                                    argv[1] ? argv[1] : "/usr/share/dict/words",
-                                    NULL), "\n");
-       num = talloc_array_length(w) - 1;
+       w = tal_strsplit(NULL, grab_file(NULL,
+                                        argv[1] ? argv[1] : "/usr/share/dict/words"), "\n", STR_NO_EMPTY);
+       num = tal_count(w) - 1;
        printf("%zu words\n", num);
 
        hcreate(num+num/3);
 
        printf("%zu words\n", num);
 
        hcreate(num+num/3);
 
-       words = talloc_array(w, ENTRY, num);
+       words = tal_arr(w, ENTRY, num);
        for (i = 0; i < num; i++) {
                words[i].key = w[i];
                words[i].data = words[i].key;
        }
 
        /* Append and prepend last char for miss testing. */
        for (i = 0; i < num; i++) {
                words[i].key = w[i];
                words[i].data = words[i].key;
        }
 
        /* Append and prepend last char for miss testing. */
-       misswords = talloc_array(w, ENTRY, num);
+       misswords = tal_arr(w, ENTRY, num);
        for (i = 0; i < num; i++) {
                char lastc;
                if (strlen(w[i]))
                        lastc = w[i][strlen(w[i])-1];
                else
                        lastc = 'z';
        for (i = 0; i < num; i++) {
                char lastc;
                if (strlen(w[i]))
                        lastc = w[i][strlen(w[i])-1];
                else
                        lastc = 'z';
-               misswords[i].key = talloc_asprintf(misswords, "%c%s%c%c",
-                                                  lastc, w[i],
-                                                  lastc, lastc);
+               misswords[i].key = tal_fmt(misswords, "%c%s%c%c",
+                                          lastc, w[i], lastc, lastc);
        }
 
        printf("#01: Initial insert: ");
        }
 
        printf("#01: Initial insert: ");
index 0b4e43448e6a9b530d1d768a149d5c43000ea629..a6e856d8c9a36f6300e7e7aa0f85245434408d4b 100644 (file)
@@ -2,12 +2,11 @@
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
 #include <ccan/hash/hash.h>
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
 #include <ccan/hash/hash.h>
+#include <ccan/time/time.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <sys/time.h>
 
 static size_t hashcount;
 struct object {
 
 static size_t hashcount;
 struct object {
@@ -95,17 +94,11 @@ static size_t count_deleted(const struct htable *ht)
 }
 
 /* Nanoseconds per operation */
 }
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timeval *start,
-                       const struct timeval *stop,
+static size_t normalize(const struct timespec *start,
+                       const struct timespec *stop,
                        unsigned int num)
 {
                        unsigned int num)
 {
-       struct timeval diff;
-
-       timersub(stop, start, &diff);
-
-       /* Floating point is more accurate here. */
-       return (double)(diff.tv_sec * 1000000 + diff.tv_usec)
-               / num * 1000;
+       return time_to_nsec(time_divide(time_sub(*stop, *start), num));
 }
 
 static size_t worst_run(struct htable *ht, size_t *deleted)
 }
 
 static size_t worst_run(struct htable *ht, size_t *deleted)
@@ -135,7 +128,7 @@ int main(int argc, char *argv[])
 {
        struct object *objs;
        size_t i, j, num, deleted;
 {
        struct object *objs;
        size_t i, j, num, deleted;
-       struct timeval start, stop;
+       struct timespec start, stop;
        struct htable_obj ht;
        bool make_dumb = false;
 
        struct htable_obj ht;
        bool make_dumb = false;
 
@@ -155,10 +148,10 @@ int main(int argc, char *argv[])
 
        printf("Initial insert: ");
        fflush(stdout);
 
        printf("Initial insert: ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++)
                htable_obj_add(&ht, objs[i].self);
        for (i = 0; i < num; i++)
                htable_obj_add(&ht, objs[i].self);
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
        printf("Details: hash size %u, mask bits %u, perfect %.0f%%\n",
               1U << ht.raw.bits, popcount(ht.raw.common_mask),
        printf(" %zu ns\n", normalize(&start, &stop, num));
        printf("Details: hash size %u, mask bits %u, perfect %.0f%%\n",
               1U << ht.raw.bits, popcount(ht.raw.common_mask),
@@ -173,61 +166,61 @@ int main(int argc, char *argv[])
 
        printf("Initial lookup (match): ");
        fflush(stdout);
 
        printf("Initial lookup (match): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++)
                if (htable_obj_get(&ht, &i)->self != objs[i].self)
                        abort();
        for (i = 0; i < num; i++)
                if (htable_obj_get(&ht, &i)->self != objs[i].self)
                        abort();
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Initial lookup (miss): ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Initial lookup (miss): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++) {
                unsigned int n = i + num;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
        for (i = 0; i < num; i++) {
                unsigned int n = i + num;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        /* Lookups in order are very cache-friendly for judy; try random */
        printf("Initial lookup (random): ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        /* Lookups in order are very cache-friendly for judy; try random */
        printf("Initial lookup (random): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0, j = 0; i < num; i++, j = (j + 10007) % num)
                if (htable_obj_get(&ht, &j)->self != &objs[j])
                        abort();
        for (i = 0, j = 0; i < num; i++, j = (j + 10007) % num)
                if (htable_obj_get(&ht, &j)->self != &objs[j])
                        abort();
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Initial delete all: ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Initial delete all: ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
        for (i = 0; i < num; i++)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
        printf("Details: rehashes %zu\n", hashcount);
 
        printf("Initial re-inserting: ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
        printf("Details: rehashes %zu\n", hashcount);
 
        printf("Initial re-inserting: ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++)
                htable_obj_add(&ht, objs[i].self);
        for (i = 0; i < num; i++)
                htable_obj_add(&ht, objs[i].self);
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Deleting first half: ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Deleting first half: ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i+=2)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
        for (i = 0; i < num; i+=2)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: rehashes %zu, delete markers %zu\n",
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: rehashes %zu, delete markers %zu\n",
@@ -239,10 +232,10 @@ int main(int argc, char *argv[])
        for (i = 0; i < num; i+=2)
                objs[i].key = num+i;
 
        for (i = 0; i < num; i+=2)
                objs[i].key = num+i;
 
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i+=2)
                htable_obj_add(&ht, objs[i].self);
        for (i = 0; i < num; i+=2)
                htable_obj_add(&ht, objs[i].self);
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: delete markers %zu, perfect %.0f%%\n",
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: delete markers %zu, perfect %.0f%%\n",
@@ -250,7 +243,7 @@ int main(int argc, char *argv[])
 
        printf("Lookup after half-change (match): ");
        fflush(stdout);
 
        printf("Lookup after half-change (match): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 1; i < num; i+=2)
                if (htable_obj_get(&ht, &i)->self != objs[i].self)
                        abort();
        for (i = 1; i < num; i+=2)
                if (htable_obj_get(&ht, &i)->self != objs[i].self)
                        abort();
@@ -259,18 +252,18 @@ int main(int argc, char *argv[])
                if (htable_obj_get(&ht, &n)->self != objs[i].self)
                        abort();
        }
                if (htable_obj_get(&ht, &n)->self != objs[i].self)
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after half-change (miss): ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after half-change (miss): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++) {
                unsigned int n = i + num * 2;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
        for (i = 0; i < num; i++) {
                unsigned int n = i + num * 2;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        /* Hashtables with delete markers can fill with markers over time.
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        /* Hashtables with delete markers can fill with markers over time.
@@ -287,7 +280,7 @@ int main(int argc, char *argv[])
                               : "fifth");
                        fflush(stdout);
                }
                               : "fifth");
                        fflush(stdout);
                }
-               gettimeofday(&start, NULL);
+               start = time_now();
                for (j = 0; j < num; j++) {
                        if (!htable_obj_del(&ht, &objs[j]))
                                abort();
                for (j = 0; j < num; j++) {
                        if (!htable_obj_del(&ht, &objs[j]))
                                abort();
@@ -295,7 +288,7 @@ int main(int argc, char *argv[])
                        if (!htable_obj_add(&ht, &objs[j]))
                                abort();
                }
                        if (!htable_obj_add(&ht, &objs[j]))
                                abort();
                }
-               gettimeofday(&stop, NULL);
+               stop = time_now();
                if (i != 0)
                        printf(" %zu ns\n", normalize(&start, &stop, num));
        }
                if (i != 0)
                        printf(" %zu ns\n", normalize(&start, &stop, num));
        }
@@ -316,45 +309,45 @@ int main(int argc, char *argv[])
 
        printf("Lookup after churn & spread (match): ");
        fflush(stdout);
 
        printf("Lookup after churn & spread (match): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++) {
                unsigned int n = num * 5 + i * 9;
                if (htable_obj_get(&ht, &n)->self != objs[i].self)
                        abort();
        }
        for (i = 0; i < num; i++) {
                unsigned int n = num * 5 + i * 9;
                if (htable_obj_get(&ht, &n)->self != objs[i].self)
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after churn & spread (miss): ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after churn & spread (miss): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i++) {
                unsigned int n = num * (5 + 9) + i * 9;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
        for (i = 0; i < num; i++) {
                unsigned int n = num * (5 + 9) + i * 9;
                if (htable_obj_get(&ht, &n))
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after churn & spread (random): ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Lookup after churn & spread (random): ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0, j = 0; i < num; i++, j = (j + 10007) % num) {
                unsigned int n = num * 5 + j * 9;
                if (htable_obj_get(&ht, &n)->self != &objs[j])
                        abort();
        }
        for (i = 0, j = 0; i < num; i++, j = (j + 10007) % num) {
                unsigned int n = num * 5 + j * 9;
                if (htable_obj_get(&ht, &n)->self != &objs[j])
                        abort();
        }
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Deleting half after churn & spread: ");
        fflush(stdout);
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        hashcount = 0;
        printf("Deleting half after churn & spread: ");
        fflush(stdout);
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i+=2)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
        for (i = 0; i < num; i+=2)
                if (!htable_obj_del(&ht, objs[i].self))
                        abort();
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Adding (a different) half after churn & spread: ");
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Adding (a different) half after churn & spread: ");
@@ -363,10 +356,10 @@ int main(int argc, char *argv[])
        for (i = 0; i < num; i+=2)
                objs[i].key = num*6+i*9;
 
        for (i = 0; i < num; i+=2)
                objs[i].key = num*6+i*9;
 
-       gettimeofday(&start, NULL);
+       start = time_now();
        for (i = 0; i < num; i+=2)
                htable_obj_add(&ht, objs[i].self);
        for (i = 0; i < num; i+=2)
                htable_obj_add(&ht, objs[i].self);
-       gettimeofday(&stop, NULL);
+       stop = time_now();
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: delete markers %zu, perfect %.0f%%\n",
        printf(" %zu ns\n", normalize(&start, &stop, num));
 
        printf("Details: delete markers %zu, perfect %.0f%%\n",
index 53ac4da650a377a0f0b27e8f74f83b2828664ac0..bd67f2814945f7f16143235f6bd3d17061700eb7 100644 (file)
@@ -1,9 +1,9 @@
 /* Simple speed tests for a hash of strings. */
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
 /* Simple speed tests for a hash of strings. */
 #include <ccan/htable/htable_type.h>
 #include <ccan/htable/htable.c>
-#include <ccan/str_talloc/str_talloc.h>
-#include <ccan/grab_file/grab_file.h>
-#include <ccan/talloc/talloc.h>
+#include <ccan/tal/str/str.h>
+#include <ccan/tal/grab_file/grab_file.h>
+#include <ccan/tal/tal.h>
 #include <ccan/hash/hash.h>
 #include <ccan/time/time.h>
 #include <stdio.h>
 #include <ccan/hash/hash.h>
 #include <ccan/time/time.h>
 #include <stdio.h>
@@ -34,44 +34,38 @@ static bool cmp(const char *obj, const char *key)
 HTABLE_DEFINE_TYPE(char, strkey, hash_str, cmp, htable_str);
 
 /* Nanoseconds per operation */
 HTABLE_DEFINE_TYPE(char, strkey, hash_str, cmp, htable_str);
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timeval *start,
-                       const struct timeval *stop,
+static size_t normalize(const struct timespec *start,
+                       const struct timespec *stop,
                        unsigned int num)
 {
                        unsigned int num)
 {
-       struct timeval diff;
-
-       timersub(stop, start, &diff);
-
-       /* Floating point is more accurate here. */
-       return (double)(diff.tv_sec * 1000000 + diff.tv_usec)
-               / num * 1000;
+       return time_to_nsec(time_divide(time_sub(*stop, *start), num));
 }
 
 int main(int argc, char *argv[])
 {
        size_t i, j, num;
 }
 
 int main(int argc, char *argv[])
 {
        size_t i, j, num;
-       struct timeval start, stop;
+       struct timespec start, stop;
        struct htable_str ht;
        char **words, **misswords;
 
        struct htable_str ht;
        char **words, **misswords;
 
-       words = strsplit(NULL, grab_file(NULL,
-                                        argv[1] ? argv[1] : "/usr/share/dict/words",
-                                        NULL), "\n");
+       words = tal_strsplit(NULL, grab_file(NULL,
+                                            argv[1] ? argv[1] : "/usr/share/dict/words"), "\n",
+                            STR_NO_EMPTY);
        htable_str_init(&ht);
        htable_str_init(&ht);
-       num = talloc_array_length(words) - 1;
+       num = tal_count(words) - 1;
        /* Note that on my system, num is just > 98304, where we double! */
        printf("%zu words\n", num);
 
        /* Append and prepend last char for miss testing. */
        /* Note that on my system, num is just > 98304, where we double! */
        printf("%zu words\n", num);
 
        /* Append and prepend last char for miss testing. */
-       misswords = talloc_array(words, char *, num);
+       misswords = tal_arr(words, char *, num);
        for (i = 0; i < num; i++) {
                char lastc;
                if (strlen(words[i]))
                        lastc = words[i][strlen(words[i])-1];
                else
                        lastc = 'z';
        for (i = 0; i < num; i++) {
                char lastc;
                if (strlen(words[i]))
                        lastc = words[i][strlen(words[i])-1];
                else
                        lastc = 'z';
-               misswords[i] = talloc_asprintf(misswords, "%c%s%c%c",
-                                              lastc, words[i], lastc, lastc);
+               misswords[i] = tal_fmt(misswords, "%c%s%c%c",
+                                      lastc, words[i], lastc, lastc);
        }
 
        printf("#01: Initial insert: ");
        }
 
        printf("#01: Initial insert: ");