make progress

This commit is contained in:
Alex Garcia 2024-04-27 12:05:21 -07:00
parent e5b0f4c0c5
commit a6b055ea39
2 changed files with 38 additions and 1 deletions

View file

@ -149,6 +149,8 @@ lint: SHELL:=/bin/bash
lint: lint:
diff -u <(cat $(FORMAT_FILES)) <(clang-format $(FORMAT_FILES)) diff -u <(cat $(FORMAT_FILES)) <(clang-format $(FORMAT_FILES))
progress:
deno run --allow-read=sqlite-vec.c scripts/progress.ts
test: test:
sqlite3 :memory: '.read test.sql' sqlite3 :memory: '.read test.sql'
@ -245,10 +247,13 @@ TARGET_WASM=$(TARGET_WASM_MJS) $(TARGET_WASM_WASM)
$(SQLITE_WASM_SRCZIP): $(BUILD_DIR) $(SQLITE_WASM_SRCZIP): $(BUILD_DIR)
curl -o $@ https://www.sqlite.org/$(SQLITE_WASM_YEAR)/sqlite-src-$(SQLITE_WASM_VERSION).zip 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) $(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) unzip -q -o $< -d $(BUILD_DIR)
(cd $(BUILD_DIR)/sqlite-src-$(SQLITE_WASM_VERSION)/ && ./configure --enable-all && make sqlite3.c) (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) $(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 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) $(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 && \ (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) $(TARGET_WASM_MJS): $(SQLITE_WASM_COMPILED_MJS)
cp $< $@ cp $< $@

31
scripts/progress.ts Normal file
View file

@ -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`);