Fork me on GitHub
#announcements
<
2021-05-02
>
ribelo10:05:41

from today doxa can be even faster than datascript https://github.com/ribelo/doxa#can-we-be-faster-than-datascript-yes

🚀 38
👏 6
ribelo13:05:06

sry, is there any place for new releases?

yuhan14:05:37

Is this a library meant for public consumption or more like a series of explorations? I found the API quite hard to understand from the Readme, and none of the public functions have docstrings - just some feedback 🙂

yuhan14:05:58

The source definitely reads more like an exploratory notebook and it seems that the dependencies on encore, timbre, shadow-cljs are only used in comment forms and should be put into some sort of :dev alias.

ribelo14:05:21

@UCPS050BV doxa was born by accident while testing what a meander can do

ribelo14:05:50

I did not expect any interest, so for a long time there were neither tests nor readme

ribelo14:05:39

I will probably write docstrings once I have worked out more or less in my head how it should look and be used.

👍 3
yuhan14:05:32

I feel like the commit function would look better taking variable arity of transactions, except there's an optional tx-meta argument which I couldn't figure out what it was for

ribelo14:05:30

tx-meta is written to the db metadata

ribelo14:05:23

you can only listen! for a specific tx-meta

ribelo15:05:55

(def conn_ (atom (dx/create-dx)))
(listen! @conn_
         (fn [db]
           (let [tx-meta ((meta db) :tx-meta)]
             (cond
               (#{:one :two} tx-meta)
               (println :something)
               (#{:three} tx-meta)
               (println :something-else)))))

(dx/commit! conn_ [:dx/put {:db/id 0 :key :value}] :one)
(dx/commit! conn_ [:dx/put {:db/id 1 :key :value}] :two)
(dx/commit! conn_ [:dx/put {:db/id 2 :key :value}] :three)
;; => repl
;; :something
;; :something
;; :something-else

steveb8n04:05:10

I like this lib and will definitely use it if it reaches prod quality. thanks for making it

wotbrew21:05:26

I am a little sceptical that a hash index {eid {k v}} could possibly beat indexed datascript in the general case? e.g not trivially small databases, and not 'get large portion of all the rows' type queries. @U0BBFDED7 any magic I am missing? Aren't value queries going to have to scan the the whole 'table'?

ribelo21:05:51

nested map can be faster due to the possibility of limiting the iterated elements, @U0GE2S1NH

ribelo21:05:55

[(datascript-query) (dx-query) (fast-dx-query)]
;; clj => [182.98 685.15 71.05] - in ms
for a normal query doxa is ~5x slower

ribelo21:05:16

By the way, initially the goal was not to race with datascript at all, rather easy interop with re-frame and seamless data synchronisation with firestore

👍 2
steveb8n22:05:29

using the re-frame app-db is why I like this lib. using datalog instead of specter for subs is a nice architecture. it does mean losing some perf because equals? can’t use identical? but that’s ok for 80% of my use cases

steveb8n23:05:14

@U0BBFDED7 do you want issues logged yet? I have a couple of feature requests: 1. runtime query & 2. query/pull without ?table. just checking when you think bugs/feature requests are useful

ribelo08:05:03

Yes, please. Especially the feature request.

steveb8n08:05:13

great. thanks

ribelo09:05:56

Do grapql entities always start with two underscores?

steveb8n09:05:21

only the :typename field. the only other standard field is :id

steveb8n09:05:21

paste this query in the left panel and run it….

steveb8n09:05:22

query { countries { typename code, name, currency } }

steveb8n09:05:01

although that api does not provide an :id so maybe not a perfect example

steveb8n09:05:47

I'm away from my desk at the moment but I saw your comment. Thanks

steveb8n09:05:36

1 question. Could a runtime arg be passed using the :in clause? That way it would match the behaviour of the other implementations

ribelo20:05:32

I have just fixed it

🙏 3