Fork me on GitHub
#datascript
<
2015-08-19
>
tonsky09:08:17

Somehow I missed there was a DataScript channel there simple_smile

tonsky09:08:18

@jonas: sorted set a much slower to scan by

tonsky09:08:41

they use binary tree (red-black), so they have to chase pointers constantly

tonsky09:08:00

in btset I have arrays much like vector has

tonsky09:08:13

inside array it’s very fast to iterate (chunking)

tonsky09:08:24

and most of the queries are index scans

tonsky09:08:30

binary lookups and index scans

tonsky09:08:22

I lose at almost everything (lookups, insertion, structural sharing percentage) but win a lot on scans

tonsky10:08:47

here’s a perf comparison between 0.11.4 and 0.11.5, when I upgraded JVM implementation from sorted-set to BTset

tonsky10:08:04

blue and green are “how much times faster”

tonsky10:08:15

reds are “how much times slower”

tonsky10:08:42

you can see it’s 50-70% slower on conj/disj/lookup

tonsky10:08:58

and 400-900% faster on iterate

jonas10:08:17

@tonsky: ok, so it’s for performance reasons. Have you tried to compare perf between clojure’s red-black trees and data.avl?

jonas10:08:47

Logically, representing ‘datoms’ as a sorted set of facts (with different sort orders, such as :avet :eavt etc) is the correct abstraction for implementing datalog? Or is there something missing from the ‘sorted set’ abstraction?

jonas10:08:19

@tonsky one more question (sorry to bother you). Is the benchmark code available somewhere?

tonsky13:08:18

yes, I think it’s the right abstraction

tonsky13:08:48

only thing missing from sorted-set is ranges

tonsky13:08:04

meaninig, you can find where X is and where Y is inside a set

jonas13:08:12

which data.avl has

tonsky13:08:15

but you cannot easily take an iterator from X to Y

jonas13:08:28

thanks for the link, I’ll take a look at it later tonight

sonnyto16:08:39

i'm getting this error:

sonnyto16:08:39

Uncaught #error {:message "Expected number or lookup ref for entity id, got :artwork.status/sold", :data {:error :entity-id/syntax, :entity-id :artwork.status/sold}}

sonnyto16:08:47

does datascript support enum?

tonsky17:08:15

@sonnyto: are you trying to use :db/ident?

tonsky17:08:21

not at the moment

tonsky17:08:32

maybe I’ll add support later

tonsky17:08:41

for now you can use lookup refs:

tonsky17:08:08

[:db/ident <keyword>] instead of <keyword> in place where entity id is expected

sonnyto17:08:05

Yes. Thanks! Will use keyword instead.

tonsky17:08:30

Yes, I found keywords to be much easier to use

sonnyto17:08:09

Oops misread. OK I'll look into it