diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index e08415a3..37e21952 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -25,5 +25,3 @@ jobs: cli: latest lein: latest - run: ./script/test_clj.sh -# - run: ./script/test_cljs.sh -# - run: ./script/test_js.sh diff --git a/bench/dbval/bench/bench.cljc b/bench/dbval/bench/bench.clj similarity index 60% rename from bench/dbval/bench/bench.cljc rename to bench/dbval/bench/bench.clj index 2d08240e..fe82f25d 100644 --- a/bench/dbval/bench/bench.cljc +++ b/bench/dbval/bench/bench.clj @@ -1,7 +1,6 @@ (ns dbval.bench.bench (:require - #?(:clj [clj-async-profiler.core :as clj-async-profiler])) - #?(:cljs (:require-macros dbval.bench.bench))) + [clj-async-profiler.core :as clj-async-profiler])) ; Measure time @@ -11,13 +10,11 @@ (def ^:dynamic *batch* 10) (def ^:dynamic *profile* false) -#?(:cljs (defn ^number now [] (js/performance.now)) - :clj (defn now ^double [] (/ (System/nanoTime) 1000000.0))) +(defn now ^double [] (/ (System/nanoTime) 1000000.0)) -#?(:clj - (defmacro dotime - "Runs form duration, returns average time (ms) per iteration" - [duration & body] +(defmacro dotime + "Runs form duration, returns average time (ms) per iteration" + [duration & body] `(let [start-t# (now) end-t# (+ ~duration start-t#)] (loop [iterations# *batch*] @@ -25,17 +22,13 @@ (let [now# (now)] (if (< now# end-t#) (recur (+ *batch* iterations#)) - (double (/ (- now# start-t#) iterations#)))))))) - -(defn- if-cljs [env then else] - (if (:ns env) then else)) + (double (/ (- now# start-t#) iterations#))))))) (defn median [xs] (nth (sort xs) (quot (count xs) 2))) (defn to-fixed [n places] - #?(:cljs (.toFixed n places) - :clj (String/format java.util.Locale/ROOT (str "%." places "f") (to-array [(double n)])))) + (String/format java.util.Locale/ROOT (str "%." places "f") (to-array [(double n)]))) (defn round [n] (cond @@ -53,30 +46,22 @@ (str s (apply str (repeat (- l (count s)) " "))) s)) -#?(:clj - (defmacro bench - "Runs for *wramup-ms* + *bench-ms*, returns median time (ms) per iteration" - [title & body] - (let [[title body] (if (string? title) - [title body] - ["unknown-bench" (cons title body)])] - (if-cljs &env - `(let [_# (dotime *warmup-ms* ~@body) - times# (mapv - (fn [_#] - (dotime *bench-ms* ~@body)) - (range *samples*))] - {:mean-ms (median times#)}) - `(let [_# (dotime *warmup-ms* ~@body) - _# (when *profile* (clj-async-profiler/start {})) - times# (mapv - (fn [_#] - (dotime *bench-ms* ~@body)) - (range *samples*)) - file# (when *profile* (clj-async-profiler/stop {:title ~title}))] - (cond-> - {:mean-ms (median times#)} - file# (assoc :file (.getAbsolutePath ^java.io.File file#)))))))) +(defmacro bench + "Runs for *warmup-ms* + *bench-ms*, returns median time (ms) per iteration" + [title & body] + (let [[title body] (if (string? title) + [title body] + ["unknown-bench" (cons title body)])] + `(let [_# (dotime *warmup-ms* ~@body) + _# (when *profile* (clj-async-profiler/start {})) + times# (mapv + (fn [_#] + (dotime *bench-ms* ~@body)) + (range *samples*)) + file# (when *profile* (clj-async-profiler/stop {:title ~title}))] + (cond-> + {:mean-ms (median times#)} + file# (assoc :file (.getAbsolutePath ^java.io.File file#)))))) ;; test dbs @@ -138,15 +123,23 @@ y (range depth) :let [from (+ (* x (inc depth)) y) to (+ (* x (inc depth)) y 1)]] - [{:db/id (inc from) + [{:db/id (str (inc from)) :name "Ivan" - :follows (inc to)} - {:db/id (inc to) + :follows (str (inc to))} + {:db/id (str (inc to)) :name "Ivan"}]))) (def people (repeatedly random-man)) +(def *people1k + "Dataset for transaction benchmarks: every iteration replays all + transactions against a fresh store, so the count stays small." + (delay + (shuffle + (take 1000 people)))) + (def *people20k + "Dataset for query benchmarks: the db is built once and only read." (delay (shuffle (take 20000 people)))) diff --git a/bench/dbval/bench/datascript.cljc b/bench/dbval/bench/run.clj similarity index 52% rename from bench/dbval/bench/datascript.cljc rename to bench/dbval/bench/run.clj index 4037c080..8fa552f8 100644 --- a/bench/dbval/bench/datascript.cljc +++ b/bench/dbval/bench/run.clj @@ -1,10 +1,18 @@ -(ns dbval.bench.datascript +(ns dbval.bench.run + "Benchmarks for dbval. + + Two kinds of benchmarks: + + - Transaction benchmarks (`add-*`, `init`, `retract-5`) replay all + transactions against a fresh store on every iteration, because a db + snapshot cannot be transacted against once its store has moved on. + They use the small `*people1k` dataset and run with `*batch*` 1. + Note: every iteration creates a temporary SQLite file. + + - Query/read benchmarks build a store once and only read from it." (:require [dbval.core :as d] - [dbval.bench.bench :as bench] - #?(:clj [jsonista.core :as jsonista]))) - -#?(:cljs (enable-console-print!)) + [dbval.bench.bench :as bench])) (def schema {:id {:db/unique :db.unique/identity} @@ -12,106 +20,133 @@ :db/cardinality :db.cardinality/many} :alias {:db/cardinality :db.cardinality/many}}) -(def empty-db (d/empty-db schema)) - -(def *db100k +(def *db20k (delay (d/db-with (d/empty-db schema) @bench/*people20k))) (defn wide-db [depth width] - (d/db-with empty-db (bench/wide-db 1 depth width))) + (d/db-with (d/empty-db schema) (bench/wide-db 1 depth width))) (defn long-db [depth width] - (d/db-with empty-db (bench/long-db depth width))) + (d/db-with (d/empty-db schema) (bench/long-db depth width))) + +;; transactions (defn bench-add-1 [] - (bench/bench - (reduce - (fn [db p] - (-> db - (d/db-with [[:db/add (:db/id p) :name (:name p)]]) - (d/db-with [[:db/add (:db/id p) :last-name (:last-name p)]]) - (d/db-with [[:db/add (:db/id p) :sex (:sex p)]]) - (d/db-with [[:db/add (:db/id p) :age (:age p)]]) - (d/db-with [[:db/add (:db/id p) :salary (:salary p)]]))) - empty-db - @bench/*people20k))) + (binding [bench/*batch* 1] + (bench/bench "add-1" + (reduce + (fn [db p] + (-> db + (d/db-with [[:db/add (:db/id p) :name (:name p)]]) + (d/db-with [[:db/add (:db/id p) :last-name (:last-name p)]]) + (d/db-with [[:db/add (:db/id p) :sex (:sex p)]]) + (d/db-with [[:db/add (:db/id p) :age (:age p)]]) + (d/db-with [[:db/add (:db/id p) :salary (:salary p)]]))) + (d/empty-db schema) + @bench/*people1k)))) (defn bench-add-5 [] - (bench/bench - (reduce - (fn [db p] - (d/db-with db [p])) - empty-db - @bench/*people20k))) + (binding [bench/*batch* 1] + (bench/bench "add-5" + (reduce + (fn [db p] + (d/db-with db [p])) + (d/empty-db schema) + @bench/*people1k)))) (defn bench-add-all [] - (bench/bench - (d/db-with - empty-db - @bench/*people20k))) + (binding [bench/*batch* 1] + (bench/bench "add-all" + (d/db-with + (d/empty-db schema) + @bench/*people1k)))) (defn bench-init [] - (let [datoms (into [] - (for [p @bench/*people20k - :let [id (#?(:clj Integer/parseInt :cljs js/parseInt) (:db/id p))] + (let [eids (into {} + (map (fn [p] [(:db/id p) (random-uuid)])) + @bench/*people1k) + datoms (into [] + (for [p @bench/*people1k + :let [id (eids (:db/id p))] [k v] p - :when (not= k :db/id)] + :when (not= k :db/id) + ;; explode cardinality-many values into datoms, + ;; like transacting the map would + v (if (sequential? v) v [v])] (d/datom id k v)))] - (bench/bench - (d/init-db datoms)))) + (binding [bench/*batch* 1] + (bench/bench "init" + (d/init-db datoms))))) + +(defn bench-retract-5 [] + ;; includes rebuilding the store: a snapshot cannot be re-retracted once + ;; its store has moved on + (binding [bench/*batch* 1] + (bench/bench "retract-5" + (let [db (d/db-with (d/empty-db schema) @bench/*people1k) + eids (->> (d/datoms db :aevt :name) (map :e) (shuffle))] + (reduce (fn [db eid] (d/db-with db [[:db.fn/retractEntity eid]])) db eids))))) + +;; reads + +(def *eids1k + (delay + (->> (d/datoms @*db20k :aevt :full-name) + (map :e) + (shuffle) + (take 1000) + (vec)))) (defn bench-find-datoms [] - (bench/bench - (doseq [id (range 9000 11000)] - (-> (d/datoms @*db100k :eavt id :full-name) - first - :v)))) + (let [db @*db20k + eids @*eids1k] + (bench/bench "find-datoms" + (doseq [id eids] + (-> (d/datoms db :eavt id :full-name) + first + :v))))) (defn bench-find-datom [] - (bench/bench - (doseq [id (range 9000 11000)] - (-> (d/find-datom @*db100k :eavt id :full-name) - :v)))) - -(defn bench-retract-5 [] - (let [db (d/db-with empty-db @bench/*people20k) - eids (->> (d/datoms db :aevt :name) (map :e) (shuffle))] - (bench/bench - (reduce (fn [db eid] (d/db-with db [[:db.fn/retractEntity eid]])) db eids)))) + (let [db @*db20k + eids @*eids1k] + (bench/bench "find-datom" + (doseq [id eids] + (-> (d/find-datom db :eavt id :full-name) + :v))))) (defn bench-q1 [] - (bench/bench + (bench/bench "q1" (d/q '[:find ?e :where [?e :name "Ivan"]] - @*db100k))) + @*db20k))) (defn bench-q2 [] - (bench/bench + (bench/bench "q2" (d/q '[:find ?e ?a :where [?e :name "Ivan"] [?e :age ?a]] - @*db100k))) + @*db20k))) (defn bench-q3 [] - (bench/bench + (bench/bench "q3" (d/q '[:find ?e ?a :where [?e :name "Ivan"] [?e :age ?a] [?e :sex :male]] - @*db100k))) + @*db20k))) (defn bench-q4 [] - (bench/bench + (bench/bench "q4" (d/q '[:find ?e ?l ?a :where [?e :name "Ivan"] [?e :last-name ?l] [?e :age ?a] [?e :sex :male]] - @*db100k))) + @*db20k))) (defn bench-q5-shortcircuit [] - (bench/bench + (bench/bench "q5-shortcircuit" (d/q '[:find ?e ?n ?l ?a ?s ?al :in $ ?n ?a :where [?e :name ?n] @@ -119,24 +154,26 @@ [?e :last-name ?l] [?e :sex ?s] [?e :alias ?al]] - @*db100k + @*db20k "Anastasia" 35))) (defn bench-qpred1 [] - (bench/bench + (bench/bench "qpred1" (d/q '[:find ?e ?s :where [?e :salary ?s] [(> ?s 50000)]] - @*db100k))) + @*db20k))) (defn bench-qpred2 [] - (bench/bench + (bench/bench "qpred2" (d/q '[:find ?e ?s :in $ ?min_s :where [?e :salary ?s] [(> ?s ?min_s)]] - @*db100k 50000))) + @*db20k 50000))) + +;; pull (def *pull-db (delay @@ -147,28 +184,30 @@ (assoc (select-keys entity [:name]) :follows (mapv f (:follows entity))))] - (bench/bench + (bench/bench "pull-one-entities" (f (d/entity @*pull-db [:id 1]))))) (defn bench-pull-one [] - (bench/bench - (d/pull @*pull-db [:name {:follows '...}] 1))) + (bench/bench "pull-one" + (d/pull @*pull-db [:name {:follows '...}] [:id 1]))) (defn bench-pull-many-entities [] (let [f (fn f [entity] (assoc (select-keys entity [:db/id :last-name :alias :sex :age :salary]) :follows (mapv f (:follows entity))))] - (bench/bench + (bench/bench "pull-many-entities" (f (d/entity @*pull-db [:id 1]))))) (defn bench-pull-many [] - (bench/bench - (d/pull @*pull-db [:db/id :last-name :alias :sex :age :salary {:follows '...}] 1))) + (bench/bench "pull-many" + (d/pull @*pull-db [:db/id :last-name :alias :sex :age :salary {:follows '...}] [:id 1]))) (defn bench-pull-wildcard [] - (bench/bench - (d/pull @*pull-db ['* {:follows '...}] 1))) + (bench/bench "pull-wildcard" + (d/pull @*pull-db ['* {:follows '...}] [:id 1]))) + +;; rules (defn bench-rules [db] (d/q '[:find ?e ?e2 @@ -183,49 +222,31 @@ (defn bench-rules-wide-3x3 [] (let [db (wide-db 3 3)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-wide-3x3" (bench-rules db)))) (defn bench-rules-wide-5x3 [] (let [db (wide-db 5 3)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-wide-5x3" (bench-rules db)))) (defn bench-rules-wide-7x3 [] (let [db (wide-db 7 3)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-wide-7x3" (bench-rules db)))) (defn bench-rules-wide-4x6 [] (let [db (wide-db 4 6)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-wide-4x6" (bench-rules db)))) (defn bench-rules-long-10x3 [] (let [db (long-db 10 3)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-long-10x3" (bench-rules db)))) (defn bench-rules-long-30x3 [] (let [db (long-db 30 3)] - (bench/bench (bench-rules db)))) + (bench/bench "rules-long-30x3" (bench-rules db)))) (defn bench-rules-long-30x5 [] (let [db (long-db 30 5)] - (bench/bench (bench-rules db)))) - -(def *serialize-db - (delay - (d/db-with empty-db - (take 300000 bench/people)))) - -#?(:clj - (def mapper - (com.fasterxml.jackson.databind.ObjectMapper.))) - -(defn bench-freeze [] - (bench/bench - (-> @*serialize-db (d/serializable) #?(:clj (jsonista/write-value-as-string mapper) :cljs js/JSON.stringify)))) - -(defn bench-thaw [] - (let [json (-> @*serialize-db (d/serializable) #?(:clj (jsonista/write-value-as-string mapper) :cljs js/JSON.stringify))] - (bench/bench - (-> json #?(:clj (jsonista/read-value mapper) :cljs js/JSON.parse) d/from-serializable)))) + (bench/bench "rules-long-30x5" (bench-rules db)))) (def benches {"add-1" bench-add-1 @@ -253,18 +274,16 @@ "rules-wide-4x6" bench-rules-wide-4x6 "rules-long-10x3" bench-rules-long-10x3 "rules-long-30x3" bench-rules-long-30x3 - "rules-long-30x5" bench-rules-long-30x5 - "freeze" bench-freeze - "thaw" bench-thaw}) + "rules-long-30x5" bench-rules-long-30x5}) (defn ^:export -main - "clj -A:bench -M -m dbval.bench.datascript [--profile] (add-1 | add-5 | ...)*" + "./script/bench.sh [--profile] (add-1 | add-5 | ...)*" [& args] (let [args (or args ()) profile? (.contains ^java.util.List args "--profile") args (remove #{"--profile"} args) names (or (not-empty args) (sort (keys benches))) - _ (apply println #?(:clj "CLJ:" :cljs "CLJS:") names) + _ (apply println "Benchmarks:" names) longest (last (sort-by count names))] (binding [bench/*profile* profile?] (doseq [name names @@ -275,42 +294,6 @@ (println (bench/right-pad name (count longest)) " " - (bench/left-pad (bench/round mean-ms) 6) "ms/op" + (bench/left-pad (bench/round mean-ms) 8) "ms/op" " " (or file "")))))) - #?(:clj (shutdown-agents)))) - -(comment - (require 'dbval.bench.datascript :reload-all) - - (bench-add-1) - (bench-add-5) - (bench-add-all) - (bench-init) - (bench-retract-5) - (bench-q1) - (bench-q2) - (bench-q3) - (bench-q4) - (bench-q5-shortcircuit) - (bench-qpred1) - (bench-qpred2) - (bench-pull-one-entities) - (bench-pull-one) - (bench-pull-many-entities) - (bench-pull-many) - (bench-pull-all) - (binding [bench/*profile* true] - (bench-pull-one)) - (binding [bench/*profile* true] - (bench-pull-many)) - (binding [bench/*profile* true] - (bench-pull-all)) - (bench-rules-wide-3x3) - (bench-rules-wide-5x3) - (bench-rules-wide-7x3) - (bench-rules-wide-4x6) - (bench-rules-long-10x3) - (bench-rules-long-30x3) - (bench-rules-long-30x5) - (bench-freeze) - (bench-thaw)) + (shutdown-agents))) diff --git a/bench_datomic/dbval/bench/datomic.clj b/bench_datomic/dbval/bench/datomic.clj deleted file mode 100644 index 37fbb6ef..00000000 --- a/bench_datomic/dbval/bench/datomic.clj +++ /dev/null @@ -1,220 +0,0 @@ -(ns dbval.bench.datomic - (:require - [clojure.string :as str] - [datomic.api :as d] - [dbval.bench.bench :as bench])) - -;; tests - -(defn- schema-attr [name type & {:as args}] - (merge - {:db/id (d/tempid :db.part/db) - :db/ident name - :db/valueType type - :db/cardinality :db.cardinality/one - :db.install/_attribute :db.part/db} - args)) - -(defn new-conn - ([] (new-conn "bench")) - ([name] - (let [url (str "datomic:mem://" name)] - (d/delete-database url) - (d/create-database url) - (let [conn (d/connect url)] - @(d/transact conn - [(schema-attr :id :db.type/long, :db/unique :db.unique/identity) - (schema-attr :name :db.type/string) - (schema-attr :last-name :db.type/string) - (schema-attr :full-name :db.type/string) - (schema-attr :sex :db.type/keyword) - (schema-attr :age :db.type/long) - (schema-attr :salary :db.type/long) - (schema-attr :alias :db.type/string, :db/cardinality :db.cardinality/many) - (schema-attr :follows :db.type/ref, :db/cardinality :db.cardinality/many)]) - conn)))) - -(defn db-with [conn tx-data] - (-> conn - (d/transact tx-data) - deref - :db-after)) - -(def *db100k - (delay - (db-with (new-conn "db100k") @bench/*people20k))) - -(defn tempid [i] - (d/tempid :db.part/user (- i))) - -(defn bench-add-1 [] - (bench/bench - (let [conn (new-conn)] - (doseq [p @bench/*people20k] - (let [report @(d/transact conn [[:db/add "p" :name (:name p)]]) - id (get (:tempids report) "p")] - @(d/transact conn [[:db/add id :last-name (:last-name p)]]) - @(d/transact conn [[:db/add id :sex (:sex p)]]) - @(d/transact conn [[:db/add id :age (:age p)]]) - @(d/transact conn [[:db/add id :salary (:salary p)]])))))) - -(defn bench-add-5 [] - (bench/bench - (let [conn (new-conn)] - (doseq [p @bench/*people20k] - @(d/transact conn [p]))))) - -(defn bench-add-all [] - (bench/bench - (let [conn (new-conn)] - @(d/transact conn @bench/*people20k)))) - -(defn bench-retract-5 [] - (bench/bench - (let [conn (new-conn) - db (db-with conn @bench/*people20k) - eids (->> (d/datoms db :aevt :name) (map :e) (shuffle))] - (doseq [eid eids] - @(d/transact conn [[:db.fn/retractEntity eid]]))))) - -(defn bench-q1 [] - (bench/bench - (d/q '[:find ?e - :where [?e :name "Ivan"]] - @*db100k))) - -(defn bench-q2 [] - (bench/bench - (d/q '[:find ?e ?a - :where [?e :name "Ivan"] - [?e :age ?a]] - @*db100k))) - -(defn bench-q3 [] - (bench/bench - (d/q '[:find ?e ?a - :where [?e :name "Ivan"] - [?e :age ?a] - [?e :sex :male]] - @*db100k))) - -(defn bench-q4 [] - (bench/bench - (d/q '[:find ?e ?l ?a - :where [?e :name "Ivan"] - [?e :last-name ?l] - [?e :age ?a] - [?e :sex :male]] - @*db100k))) - -(defn bench-qpred1 [] - (bench/bench - (d/q '[:find ?e ?s - :where [?e :salary ?s] - [(> ?s 50000)]] - @*db100k))) - -(defn bench-qpred2 [] - (bench/bench - (d/q '[:find ?e ?s - :in $ ?min_s - :where [?e :salary ?s] - [(> ?s ?min_s)]] - @*db100k 50000))) - -(def *pull-db - (delay - (db-with (new-conn "pull-db") (bench/wide-db 1 4 5)))) - -(defn bench-pull-one [] - @*pull-db - (bench/bench - (d/pull @*pull-db [:name {:follows '...}] [:id 1]))) - -(defn bench-pull-one-entities [] - @*pull-db - (let [f (fn f [entity] - (assoc - (select-keys entity [:name]) - :follows (mapv f (:follows entity))))] - (bench/bench - (f (d/entity @*pull-db [:id 1]))))) - -(defn bench-pull-many [] - @*pull-db - (bench/bench - (d/pull @*pull-db [:db/id :last-name :alias :sex :age :salary {:follows '...}] [:id 1]))) - -(defn bench-pull-many-entities [] - @*pull-db - (let [f (fn f [entity] - (assoc - (select-keys entity [:db/id :last-name :alias :sex :age :salary]) - :follows (mapv f (:follows entity))))] - (bench/bench - (f (d/entity @*pull-db [:id 1]))))) - -(defn bench-pull-wildcard [] - @*pull-db - (bench/bench - (d/pull @*pull-db ['* {:follows '...}] [:id 1]))) - -(def benches - {"add-1" bench-add-1 - "add-5" bench-add-5 - "add-all" bench-add-all - "retract-5" bench-retract-5 - "q1" bench-q1 - "q2" bench-q2 - "q3" bench-q3 - "q4" bench-q4 - "qpred1" bench-qpred1 - "qpred2" bench-qpred2 - "pull-one" bench-pull-one - "pull-one-entities" bench-pull-one-entities - "pull-many" bench-pull-many - "pull-many-entities" bench-pull-many-entities - "pull-wildcard" bench-pull-wildcard}) - -(defn -main - "clj -A:bench:datomic -M -m dbval.bench.datomic [--profile] (add-1 | add-5 | ...)*" - [& args] - (let [profile? (.contains (or args ()) "--profile") - args (remove #{"--profile"} args) - names (or (not-empty args) (sort (keys benches))) - _ (apply println "Datomic:" names) - longest (last (sort-by count names))] - (binding [bench/*profile* profile?] - (doseq [name names - :let [fn (benches name)]] - (if (nil? fn) - (println - (bench/right-pad name (count longest)) - " ---") - (let [{:keys [mean-ms file]} (fn)] - (println - (bench/right-pad name (count longest)) - " " - (bench/left-pad (bench/round mean-ms) 6) "ms/op" - " " (or file "")))))) - (shutdown-agents))) - -(comment - (-main) - (clojure.pprint/pprint (bench/wide-db 1 2 2)) - - (bench-add-1) - (bench-add-5) - (bench-add-all) - (bench-retract-5) - (bench-q1) - (bench-q2) - (bench-q3) - (bench-q4) - (bench-qpred1) - (bench-qpred2) - (bench-pull-one) - (bench-pull-one-entities) - (bench-pull-many) - (bench-pull-many-entities) - (bench-pull-wildcard)) \ No newline at end of file diff --git a/deps.edn b/deps.edn index 2a57f6d1..569483d5 100644 --- a/deps.edn +++ b/deps.edn @@ -1,8 +1,5 @@ {:deps - {persistent-sorted-set/persistent-sorted-set {:mvn/version "0.3.0"} - io.github.tonsky/extend-clj {:mvn/version "0.1.0"} - org.foundationdb/fdb-java {:mvn/version "7.3.47"} - com.taoensso/nippy {:mvn/version "3.6.0"} + {org.foundationdb/fdb-java {:mvn/version "7.3.47"} org.xerial/sqlite-jdbc {:mvn/version "3.47.1.0"} com.yetanalytics/colossal-squuid {:mvn/version "0.1.5" :exclusions @@ -12,12 +9,7 @@ } :aliases - {:cljs - {:extra-paths ["test"] - :extra-deps - {org.clojure/clojurescript {:mvn/version "1.11.132"}}} - - :1.9 + {:1.9 {:override-deps {org.clojure/clojure {:mvn/version "1.9.0"}}} @@ -38,10 +30,7 @@ :jvm-opts ["-ea" "-Ddbval.debug" "-Dclojure.main.report=stderr" "-Djdk.attach.allowAttachSelf"] :extra-deps {io.github.tonsky/duti {:git/sha "e36d65296a4f9758664309ec35b00887e88c405a"} - metosin/jsonista {:mvn/version "0.3.3"} - cheshire/cheshire {:mvn/version "5.10.0"} - com.cognitect/transit-clj {:mvn/version "1.0.324"} - com.cognitect/transit-cljs {:mvn/version "0.8.269"}}} + com.cognitect/transit-clj {:mvn/version "1.0.324"}}} :bench {:extra-paths ["bench"] @@ -50,10 +39,4 @@ "-Djdk.attach.allowAttachSelf" "-XX:+DebugNonSafepoints"] :extra-deps - {metosin/jsonista {:mvn/version "0.3.3"} - io.github.tonsky/duti {:git/sha "e36d65296a4f9758664309ec35b00887e88c405a"}}} - - :datomic - {:extra-paths ["bench_datomic" "test_datomic"] - :extra-deps - {com.datomic/peer {:mvn/version "1.0.6735"}}}}} + {io.github.tonsky/duti {:git/sha "e36d65296a4f9758664309ec35b00887e88c405a"}}}}} diff --git a/dev/user.clj b/dev/user.clj index 3b1ed25f..051f2109 100644 --- a/dev/user.clj +++ b/dev/user.clj @@ -11,7 +11,7 @@ duti/-main) (defn test-all [] - (duti/test #"dbval\.test\.(?!cljs).*")) + (duti/test #"dbval\.test\..*")) (defn -test-main [_] - (duti/test-exit #"dbval\.test\.(?!cljs).*")) + (duti/test-exit #"dbval\.test\..*")) diff --git a/release-js/README.md b/release-js/README.md deleted file mode 100644 index 30029370..00000000 --- a/release-js/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# DataScript - -An immutable in-memory database and Datalog query engine for JS engines. - -DataScript is meant to run inside the browser. It is cheap to create, quick to query and ephemeral. You create a database on page load, put some data in it, track changes, do queries and forget about it when the user closes the page. - -DataScript databases are immutable and based on persistent data structures. In fact, they’re more like data structures than databases (think Hashmap). Unlike querying a real SQL DB, when you query DataScript, it all comes down to a Hashmap lookup. Or series of lookups. Or array iteration. There’s no particular overhead to it. You put a little data in it, it’s fast. You put in a lot of data, well, at least it has indexes. That should do better than you filtering an array by hand anyway. The thing is really lightweight. - -The intention with DataScript is to be a basic building block in client-side applications that needs to track a lot of state during their lifetime. There’s a lot of benefits: - -- Central, uniform approach to manage all application state. Clients working with state become decoupled and independent: rendering, server sync, undo/redo do not interfere with each other. -- Immutability simplifies things even in a single-threaded browser environment. Keep track of app state evolution, rewind to any point in time, always render consistent state, sync in background without locking anybody. -- Datalog query engine to answer non-trivial questions about current app state. -- Structured format to track data coming in and out of DB. Datalog queries can be run against it too. - -For more info, check out [project page](https://github.com/tonsky/datascript) diff --git a/release-js/package.json b/release-js/package.json deleted file mode 100644 index d8ec7724..00000000 --- a/release-js/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "datascript", - "version": "1.7.5", - "description": "Immutable in-memory triplestore with Datalog queries", - "homepage": "https://github.com/tonsky/datascript", - "author": "Nikita Prokopov (https://github.com/tonsky)", - "keywords": [ - "data", - "database", - "triplestore", - "datalog", - "persistent", - "immutable", - "clojure", - "clojurescript" - ], - "contributors": [ - "Nikita Prokopov (https://github.com/tonsky)", - "David Thomas Hume (https://github.com/dthume)", - "montyxcantsin (https://github.com/montyxcantsin)", - "Ben Fleis (https://github.com/benfleis)", - "Gijs Stuurman (https://github.com/thegeez)", - "Yevgeny Armor (https://github.com/izirku)", - "Kevin Lynagh (https://github.com/lynaghk)", - "Bobby Calderwood (https://github.com/bobby)" - ], - "bugs": { - "url": "https://github.com/tonsky/datascript/issues" - }, - "licenses": [ - { - "type": "EPL", - "url": "https://github.com/tonsky/datascript/blob/master/LICENSE" - } - ], - "main": "./datascript.js", - "repository": { - "type": "git", - "url": "git://github.com/tonsky/datascript.git" - }, - "engines": { - "node": ">=0.8.22" - }, - "dependencies": {}, - "files": ["datascript.js"] -} diff --git a/release-js/test_include_amd.html b/release-js/test_include_amd.html deleted file mode 100644 index 8a959ba0..00000000 --- a/release-js/test_include_amd.html +++ /dev/null @@ -1,24 +0,0 @@ - - -
-Check the browser console for errors and output.
- - - - - - diff --git a/release-js/test_include_node.js b/release-js/test_include_node.js deleted file mode 100644 index a5680bd9..00000000 --- a/release-js/test_include_node.js +++ /dev/null @@ -1,6 +0,0 @@ -var d = require('./datascript'); -var conn = d.create_conn(); -d.transact(conn, [[":db/add", -1, "name", "Ivan"]]); -var res = d.q("[:find ?e ?v :where [?e \"name\" ?v]]", d.db(conn)); -var res_str = JSON.stringify(res); -console.log(res_str); // => [[1, "Ivan"]] diff --git a/release-js/test_include_script.html b/release-js/test_include_script.html deleted file mode 100644 index ff40563e..00000000 --- a/release-js/test_include_script.html +++ /dev/null @@ -1,26 +0,0 @@ - - - -Check the browser console for errors and output.
- - - - - diff --git a/release-js/wrap_bare.sh b/release-js/wrap_bare.sh deleted file mode 100755 index 05a3204c..00000000 --- a/release-js/wrap_bare.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e - -(cat release-js/wrapper.prefix; cat release-js/datascript.bare.js; cat release-js/wrapper.suffix) > release-js/datascript.js - -echo "Packed release-js/datascript.js" diff --git a/release-js/wrapper.prefix b/release-js/wrapper.prefix deleted file mode 100644 index 27de4a46..00000000 --- a/release-js/wrapper.prefix +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Datascript v1.7.5 - * - * Copyright 2014-2021 Nikita Prokopov - * - * Licensed under Eclipse Public License; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://github.com/tonsky/datascript/blob/master/LICENSE - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function (definition) { - // This file will function properly as a