nostrdb

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

commit 1b389a869f8836af4cf80f5fe4c884817dfe47c3
parent 050438e62c7fd468fb0b492d6b0bcd62b3aa685a
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 11 Aug 2023 21:40:56 -0700

make: fix build on linux, bump queue sizes

Diffstat:
MMakefile | 4++--
Mbench-ingest.c | 1+
Mnostrdb.c | 8++------
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -2,7 +2,7 @@ CFLAGS = -Wall -Wno-unused-function -Werror -O2 -g -Ideps/secp256k1/include -Ide HEADERS = sha256.h nostrdb.h cursor.h hex.h jsmn.h config.h sha256.h random.h memchr.h FLATCC_SRCS=deps/flatcc/src/runtime/json_parser.c deps/flatcc/src/runtime/builder.c deps/flatcc/src/runtime/emitter.c deps/flatcc/src/runtime/refmap.c SRCS = nostrdb.c sha256.c $(FLATCC_SRCS) -LDS = $(ARS) $(SRCS) +LDS = $(SRCS) $(ARS) DEPS = $(SRCS) $(HEADERS) $(ARS) ARS = deps/lmdb/liblmdb.a deps/secp256k1/.libs/libsecp256k1.a LMDB_VER=0.9.31 @@ -83,7 +83,7 @@ deps/LMDB_$(LMDB_VER).tar.gz: deps/.dir deps/flatcc_$(FLATCC_VER).tar.gz: deps/.dir curl -L https://github.com/dvidelabs/flatcc/archive/refs/tags/v0.6.1.tar.gz -o $@ -deps/flatcc/include/flatcc/flatcc.h: deps/flatcc_$(FLATCC_VER).tar.gz deps/.dir +deps/flatcc/src/runtime/json_parser.c: deps/flatcc_$(FLATCC_VER).tar.gz deps/.dir tar xf $< rm -rf deps/flatcc mv flatcc-$(FLATCC_VER) deps/flatcc diff --git a/bench-ingest.c b/bench-ingest.c @@ -16,6 +16,7 @@ static int bench_parser(int times) struct ndb *ndb; struct timespec t1, t2; + written = 0; mapsize = 1024 * 1024 * 100; ingester_threads = 8; assert(ndb_init(&ndb, mapsize, ingester_threads)); diff --git a/nostrdb.c b/nostrdb.c @@ -20,10 +20,10 @@ #include "secp256k1_schnorrsig.h" // the maximum number of things threads pop and push in bulk -static const int THREAD_QUEUE_BATCH = 1024; +static const int THREAD_QUEUE_BATCH = 4096; // the maximum size of inbox queues -static const int DEFAULT_QUEUE_SIZE = 50000; +static const int DEFAULT_QUEUE_SIZE = 1000000; #define NDB_PARSED_ID (1 << 0) @@ -314,15 +314,11 @@ static enum ndb_idres ndb_ingester_json_controller(void *data, const char *hexid { unsigned char id[32]; struct ndb_ingest_controller *c = data; - MDB_val key; hex_decode(hexid, 64, id, sizeof(id)); // let's see if we already have it - key.mv_size = 32; - key.mv_data = id; - if (!ndb_has_note(c->read_txn, c->lmdb, id)) return NDB_IDRES_CONT;