Fork me on GitHub
#datascript
<
2016-12-01
>
tawus03:12:13

Ok, I have moved the loading of data (transact) to server and then using edn serialization to pass it to server. The advantage is that things are not slow on mobile devices. I am still looking for ways to optimize the loading on server side but it is a better solution for now.

escherize03:12:09

Is there an easier interface for data script, where to the user it looks like inserting maps, and matching "pieces" (or map entries) of maps to query?

Niki08:12:48

@tawus using transit can make things even faster

Niki08:12:04

@escherize no, nothing I’m aware of

tawus10:12:24

@tonsky: using transit with datoms instead of entity maps. right ?

Niki10:12:37

I meant in general transit is faster than edn

Niki11:12:27

I don't really understand what are sending from your description

tawus13:12:40

I have datomic data (about 5000+ entities for now). I was passing this from server to client and then using transact to add it to the datascript database on the client. Although it was taking 2-3 seconds on my desktop browser but on mobile devices it was taking more than 10 seconds. Now I am using datascript on the server too. So the data from the datomic is inserted into datascript database and then serialized as edn to the server. On client we just use conn-from-db after deserialization. So, in summary, the data insertion into datascript database is happening on server, then datascript database is serialized to the client as edn, and then data deserialization is happening on the client. Although it is almost the same thing but now the painful part is on the server and so mobile devices are as fast as the desktop browser. I hope it is clear now.

Niki13:12:51

Yes, thanks

Niki13:12:42

You did all the right things: servers are much more performant than clients, and Clojure datascript is about twice as fast as client datascript

Niki13:12:03

But I'd recommend to use transit as serialization format

Niki13:12:26

Decoding it on a client MUCH faster than EDN

Niki13:12:47

There's a library for DataScript called datascript-transit

Niki13:12:32

It provides custom DB and Datom readers/writers for transit

Niki13:12:00

Give it a try, it should be very easy to get started

Niki13:12:14

And perf benefits are potentially very big

tawus14:12:47

Ah. Sorry, I confused transit with transact may be because I have been using too much of transact 🙂 Thanks for the suggestion. I’ll check it out and let you know how it goes. Thanks! really appreciate your help.

Niki14:12:39

Haha yeah they look really similar :)