diff --git a/Makefile b/Makefile index cb8ebcd..15e9935 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,8 @@ lint: SHELL:=/bin/bash lint: diff -u <(cat $(FORMAT_FILES)) <(clang-format $(FORMAT_FILES)) +progress: + deno run --allow-read=sqlite-vec.c scripts/progress.ts test: sqlite3 :memory: '.read test.sql' @@ -245,10 +247,13 @@ TARGET_WASM=$(TARGET_WASM_MJS) $(TARGET_WASM_WASM) $(SQLITE_WASM_SRCZIP): $(BUILD_DIR) curl -o $@ https://www.sqlite.org/$(SQLITE_WASM_YEAR)/sqlite-src-$(SQLITE_WASM_VERSION).zip + touch $@ $(SQLITE_WASM_COMPILED_SQLITE3C): $(SQLITE_WASM_SRCZIP) $(BUILD_DIR) + rm -rf $(BUILD_DIR)/sqlite-src-$(SQLITE_WASM_VERSION)/ || true unzip -q -o $< -d $(BUILD_DIR) (cd $(BUILD_DIR)/sqlite-src-$(SQLITE_WASM_VERSION)/ && ./configure --enable-all && make sqlite3.c) + touch $@ $(TARGET_WASM_LIB): examples/wasm/wasm.c sqlite-vec.c $(BUILD_DIR) $(WASM_DIR) emcc -O3 -I./ -Ivendor -DSQLITE_CORE -c examples/wasm/wasm.c -o $(BUILD_DIR)/wasm.wasm.o @@ -257,7 +262,8 @@ $(TARGET_WASM_LIB): examples/wasm/wasm.c sqlite-vec.c $(BUILD_DIR) $(WASM_DIR) $(SQLITE_WASM_COMPILED_MJS) $(SQLITE_WASM_COMPILED_WASM): $(SQLITE_WASM_COMPILED_SQLITE3C) $(TARGET_WASM_LIB) (cd $(BUILD_DIR)/sqlite-src-$(SQLITE_WASM_VERSION)/ext/wasm && \ - make sqlite3_wasm_extra_init.c=../../../../.wasm/libsqlite_vec.wasm.a "emcc.flags=-s EXTRA_EXPORTED_RUNTIME_METHODS=['ENV'] -s FETCH") + make sqlite3_wasm_extra_init.c=../../../../.wasm/libsqlite_vec.wasm.a jswasm/sqlite3.mjs jswasm/sqlite3.wasm \ + ) $(TARGET_WASM_MJS): $(SQLITE_WASM_COMPILED_MJS) cp $< $@ diff --git a/scripts/progress.ts b/scripts/progress.ts new file mode 100644 index 0000000..8e0ee66 --- /dev/null +++ b/scripts/progress.ts @@ -0,0 +1,31 @@ +const src = Deno.readTextFileSync("sqlite-vec.c"); + +function numOccuranges(rg) { + return [...src.matchAll(rg)].length; +} +const numAsserts = numOccuranges(/todo_assert/g); +const numComments = numOccuranges(/TODO/g); +const numHandles = numOccuranges(/todo\(/g); + +const realTodos = numOccuranges(/TODO\(/g); + +const numTotal = numAsserts + numComments + numHandles - realTodos; + +console.log("Number of todo_assert()'s: ", numAsserts); +console.log('Number of "// TODO" comments: ', numComments); +console.log("Number of todo panics: ", numHandles); +console.log("Total TODOs: ", numTotal); + +console.log(); + +const TOTAL = 246; // as of e5b0f4c0c5 (2024-04-20) +const progress = (TOTAL - numTotal) / TOTAL; +const width = 60; + +console.log( + "▓".repeat(progress * width) + + "░".repeat((1 - progress) * width) + + ` (${numTotal - TOTAL}/${TOTAL})` +); +console.log(); +console.log(`${progress * 100.0}% complete to sqlite-vec v0`);