This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-22
Channels
- # architecture (1)
- # aws (3)
- # beginners (78)
- # boot (33)
- # cider (49)
- # cljs-dev (3)
- # clojure (82)
- # clojure-berlin (2)
- # clojure-dusseldorf (14)
- # clojure-gamedev (75)
- # clojure-italy (15)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (1)
- # clojure-spec (11)
- # clojure-uk (91)
- # clojurescript (17)
- # core-async (2)
- # cursive (1)
- # data-science (3)
- # datascript (34)
- # datomic (13)
- # docs (2)
- # duct (32)
- # emacs (8)
- # fulcro (95)
- # instaparse (17)
- # jobs (2)
- # jobs-discuss (1)
- # jobs-rus (4)
- # leiningen (1)
- # luminus (1)
- # lumo (4)
- # mount (1)
- # nrepl (1)
- # off-topic (98)
- # onyx (13)
- # portkey (12)
- # re-frame (10)
- # reagent (11)
- # remote-jobs (4)
- # rum (3)
- # shadow-cljs (34)
- # specter (7)
- # sql (1)
- # tools-deps (8)
@ronb you mentioned that your version of Datascript is not backwards compatible. What are the breaking changes?
@kiemdoder Attributes are stored as Integers (d/datom 0 :attr :val) is not allowed anymore Queries return attributes as Integers, not Keywords You need to define the Attribute order in the schema -> {:attr {:db/order 0}} Transaction Id’s are created from 2^24 -1 downwards New range for Entity ID’s is from 0 to 2^24 New range for valid Transaction ID’s is from 2^24 to (2^24) - 2^20
Every attribute is represented as an ID (similar to Datomic) All attributes need a db/order key in the schema
Will do some benchmarking and better Docs. @tonsky Thanks for the reply on the pull request. I will reply later
I’d say, semantically, biggest setback for existing users would be:
— lack of datom
call with keyword attribute
— unexpected integers in query results (although I believe impl can be changed to return keywords)
— the need to specify all attributes in schema (:db/order could be probably calculated, but it requires all attributes to be specified explicitly)
@tonsky I completely agree. Right now the backwards incompatibilities are too big. If I address the issues you mentioned, would you be willing to merge the pull request or do you prefer a seperate project?
most incompatibilities could be addressed with code in db/-search and (transact-add), but changes in how (datom) constructor works would remain and probably be confusing to users
I don’t see how we can work around requiring that every attribute must be specified in schema. So far it’s not required and I believe most users rely on that
And then there’s JS story, which lacks 64-bit numbers so that schema wouldn’t work as well there :(
it feels like jvm-only, separate project with no backwards compatibility guarantees would be best
Yeah it would require additional logic in transaction handling to add new attributes on demand and is a bit messy 😄
i use 64 bit floats to guarantee compatibility with JS environments. All tests run successfully on JVM and JS as far as I can see
I was under impression JS bit operations only work on 32-bit ints? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
You can cheat if you do the following: (/ num (js/Math.pow 2 32)) -> gives access to the upper part of float numbers in the lower 32 bit region
Will test the performance in the evening, but i compared this with bit-shift operators and they have similar performance. Looks like JS engine optimize (/ num some-binary-exponent) into (bit-shift-right )
^^ maybe helpful?
btw maybe instead of trying to fit everything into one 64-bit value, it might be easier to fit everything in two 32-bit values? memory consumption will be the same
that's what goog.math.Long
and therefore ^^ does
depends what you want to do
@thedavidmeister Looks interesting, thanks for the link. I looked into using goog.math.Long based solution. but if i understand correctly how js engines work, it would use twice the memory of a single double number
although maybe i am mistaken and engines actually detect that you only use 32bits of the number and optimize the rest away