from today doxa
can be even faster than datascript
https://github.com/ribelo/doxa#can-we-be-faster-than-datascript-yes
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. @huxley any magic I am missing? Aren't value queries going to have to scan the the whole 'table'?
nested map can be faster due to the possibility of limiting the iterated elements, @danstone
[(datascript-query) (dx-query) (fast-dx-query)]
;; clj => [182.98 685.15 71.05] - in ms
for a normal query doxa is ~5x slowerBy 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
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
@huxley 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
Yes, please. Especially the feature request.
great. thanks
Do grapql entities always start with two underscores?
only the :typename field. the only other standard field is :id
you can see it here https://countries.trevorblades.com/
paste this query in the left panel and run itβ¦.
query { countries { typename code, name, currency } }
although that api does not provide an :id so maybe not a perfect example
I'm away from my desk at the moment but I saw your comment. Thanks
1 question. Could a runtime arg be passed using the :in clause? That way it would match the behaviour of the other implementations
I have just fixed it
You posted a link to the same library 2 weeks ago. https://clojurians.slack.com/archives/C06MAR553/p1618679544447900
sry, is there any place for new releases?
#releases
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 π
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.
@qythium doxa was born by accident while testing what a meander can do
I did not expect any interest, so for a long time there were neither tests nor readme
I will probably write docstrings once I have worked out more or less in my head how it should look and be used.
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
tx-meta
is written to the db
metadata
you can only listen!
for a specific tx-meta
(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