datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
souenzzo 2019-09-29T03:00:13.004900Z

@quest :in [$ ?idc] should be :in $ ?idc

👍 1
Quest 2019-09-29T03:47:18.005300Z

@souenzzo doh. thank you!

Oliver George 2019-09-29T04:21:23.006Z

Is this likely to be the fastest way to get data into a datascript db?

(defn data->datoms [ms]
  (let [n (atom 0)]
    (for [m ms
          :let [e (swap! n inc)]
          [a v] m
          :when (not (nil? v))]
      (d/datom e a v))))

(let [datoms (data->datoms ms)
      schema {:PK {:db/unique :db.unique/identity}}]
  (d/init-db datoms schema)))

Oliver George 2019-09-29T11:17:48.007600Z

I'm trying to work out how to load up a big db in a react-native app. Problem I have is that 60k datoms is slow enough to risk impacting user experience. It takes around 500ms.

Oliver George 2019-09-29T11:19:31.009100Z

I'd like to find a fast way to load which I can break up so it's not all done in one hit. Looking at the implementation I think that's unlikely. The work seems to be in preparing the indexes which doesn't lend itself being broken up.