Fork me on GitHub
#datascript
<
2019-09-29
>
souenzzo03:09:13

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

👍 1
Quest03:09:18

@souenzzo doh. thank you!

Oliver George04:09:23

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 George11:09:48

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 George11:09:31

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.