Fork me on GitHub
#asami
<
2021-12-11
>
Lukas Domagala16:12:42

@quoll hi, I’m not sure this is the right place to ask, so it’s totally fine if you don’t 😄 I have a trace log where every entry looks kind of like this:

{:args [[:quarter :quarter :nickel]],
    :end 1639239215905,
    :id :54579,
    :inner [],
    :meta
      {:arglists ([coins]),
       :column 1,
       :file
         "/Users/lukas/Workspace/clojure/omni-trace/src/cyrik/omni_trace/testing_ns.cljc",
       :line 9,
       :name calc-coin-value,
       :ns #namespace [cyrik.omni-trace.testing-ns]},
    :name cyrik.omni-trace.testing-ns/calc-coin-value,
    :parent :54578,
    :return 0.55,
    :start 1639239215905}
and i need to throw this into a graph to be able to ask questions like: what was the last call to some name, whats the path from id to the root and so on. this should be performant on the read + the write side. is asami a good solution for this or should i look into something that is more low level?

quoll16:12:40

Asami could do this, yes

Lukas Domagala16:12:28

i’m guessing, my question is less “can it” and more “how much slower” will it be to get asami’s nice api vs doing it on “raw” data. and will asami blow my memory by making copies of everything i pass it?

quoll16:12:19

Well, if you put it into an in-memory database, then yes. It turns it all into triples (entity-attribute-value), and indexes them. If you want to query it in-place, then Meander may be better for you

quoll16:12:09

(You can also save the graph on disk, but that takes longer to index, but it's saved then and queries are fast)

Lukas Domagala16:12:11

that makes sense, thank you. final question: if a lot of the maps in the trace have the same data, or at least shared parts underneath, will asami also have memory sharing for its own representations or will it have completely new maps for every :args [[:quarter :quarter :nickel]] for example?

quoll16:12:38

If they share an :id then they will be shared.

Lukas Domagala16:12:08

ah interesting, so it might be ok if i restructure my traces before passing them in. thank you. i’ll play around with it and see if my memory blows up too badly.

quoll17:12:18

If memory is the issue, I’d save them to disk. But I recommend trying Meander as well

Lukas Domagala17:12:09

yeah i’ll try that as well, thank you. my problem with to disk is the write speed, since the idea is to use it as an interactive tool in the repl

quoll17:12:43

I’m currently working on fixing that, but it'll be a while

quoll17:12:34

(It will all go to memory, then sent to disk in the background)