nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit f277cc768d39d38d089969aba442354b183dc6d8
parent bf5f4237a4a0d4967f443c21d2a43b7ef3de9828
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  1 Dec 2023 15:29:12 -0800

remove old benchmark

Diffstat:
MMakefile | 3---
Dbench-ingest.c | 57---------------------------------------------------------
2 files changed, 0 insertions(+), 60 deletions(-)

diff --git a/Makefile b/Makefile @@ -136,9 +136,6 @@ deps/lmdb/liblmdb.a: deps/lmdb/lmdb.h bench: bench.c $(DEPS) $(CC) $(CFLAGS) bench.c $(LDS) -o $@ -bench-ingest: bench-ingest.c $(DEPS) - $(CC) $(CFLAGS) bench-ingest.c $(LDS) -o $@ - testdata/db/ndb-v0.tar.zst: curl https://cdn.jb55.com/s/ndb-v0.tar.zst -o $@ diff --git a/bench-ingest.c b/bench-ingest.c @@ -1,57 +0,0 @@ - - -#include "io.h" -#include "nostrdb.h" -#include <sys/mman.h> -#include <time.h> -#include <stdlib.h> -#include <assert.h> - -static int bench_parser(int times) -{ - char *json = malloc(1024 * 100); - int i, mapsize, written, ingester_threads; - long nanos, ms; - static const int alloc_size = 2 << 18; - struct ndb *ndb; - struct timespec t1, t2; - - written = 0; - mapsize = 1024 * 1024 * 100; - ingester_threads = 8; - assert(ndb_init(&ndb, "testdata/db", mapsize, ingester_threads, 0)); - read_file("testdata/contacts-event.json", (unsigned char*)json, alloc_size, &written); - - clock_gettime(CLOCK_MONOTONIC, &t1); - - for (i = 0; i < times; i++) { - ndb_process_event(ndb, json, written); - } - - free(json); - ndb_destroy(ndb); - - clock_gettime(CLOCK_MONOTONIC, &t2); - - nanos = (t2.tv_sec - t1.tv_sec) * (long)1e9 + (t2.tv_nsec - t1.tv_nsec); - ms = nanos / 1e6; - printf("ns/run\t%ld\nms/run\t%f\nns\t%ld\nms\t%ld\n", - nanos/times, (double)ms/(double)times, nanos, ms); - - return 1; -} - -int main(int argc, char *argv[], char **env) -{ - int times = 50000; - - if (argc >= 2) - times = atoi(argv[1]); - - fprintf(stderr, "benching %d duplicate contact events\n", times); - if (!bench_parser(times)) - return 2; - - return 0; -} -