-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Description
Feature Request
Right now, we are using a combination of get_constants to extract the constants from the tree, and set_constants! to put them back in. This is fast but it's not negligible.
What would be faster is to store the constant nodes in a vector of type Node{T}. Then, we can simply loop through the list and set the constants. This is because the node is not copied at any stage of the evaluation, so this sort of acts like pointers to the constant nodes.
We can do this once this merges: SymbolicML/DynamicExpressions.jl#27
constant_nodes = filter(t -> t.degree == 0 && t.constant, tree)
c0 = [t.val::T for t in constant_nodes]
# ...
for i in eachindex(c0)
constant_nodes[i].val::T = c[i]
endMetadata
Metadata
Assignees
Labels
No labels