Skip to content

Simplifying logic#9

Open
poncito wants to merge 8 commits intomainfrom
simplifying-logic
Open

Simplifying logic#9
poncito wants to merge 8 commits intomainfrom
simplifying-logic

Conversation

@poncito
Copy link
Owner

@poncito poncito commented Aug 3, 2023

Hi @baumgold ,
I changed the "logic" of this. I have a clearer separation of the "compiled" and "uncompiled" graphs.
It changes the API:

  • no more Source,
  • instead a call to compile to explicitly compile the graph
  • the calls to push! require the compiled graph (returned by compile)
    Also, the (optional) tracking is integrated to the graph, no need to pass it to the push!

If you could have a look to the API, to tell me if you feel like it's good enough, that would be cool.

My next step is to change this whole "naming" of the nodes (that currently rely on gensym-ed names), to use some kind of hash of the operations instead. The goal is to avoid compiling several times the same nodes. It's not going to work in all cases as anonymous functions are compiled differently each time (whit a gensym-ed name). So creating twice a map node with an anonymous function is problematic. It can only work if the mapped function is named. But that is not surprising in Julia.

@poncito poncito requested a review from baumgold August 3, 2023 09:18
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #9 (6ff8519) into main (a48e26c) will decrease coverage by 0.41%.
Report is 1 commits behind head on main.
The diff coverage is 94.39%.

@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
- Coverage   95.14%   94.73%   -0.41%     
==========================================
  Files          15       15              
  Lines         350      323      -27     
==========================================
- Hits          333      306      -27     
  Misses         17       17              
Files Changed Coverage Δ
src/ReactiveGraphs.jl 78.57% <ø> (-2.68%) ⬇️
src/constant.jl 100.00% <ø> (ø)
src/updated.jl 100.00% <ø> (ø)
src/compilation.jl 92.42% <91.52%> (-3.23%) ⬇️
src/graph.jl 82.60% <95.00%> (-4.90%) ⬇️
src/filter.jl 100.00% <100.00%> (ø)
src/foldl.jl 86.36% <100.00%> (-0.60%) ⬇️
src/inlinedmap.jl 100.00% <100.00%> (ø)
src/input.jl 100.00% <100.00%> (ø)
src/lag.jl 100.00% <100.00%> (ø)
... and 3 more

x4 = map((x,y)->println("x4"), x2, x3)
push!(Source(x1), nothing) # prints x2 x3 x4
g, s1 = compile(x1)
push!(g, s1, nothing) # prints x2 x3 x4
Copy link
Collaborator

@baumgold baumgold Aug 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push! notation seems a little awkward. If you think of the graph as a Dict of Source => Value pairs then maybe a nice API might be setindex! instead?

g[s1] = nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants