lang: Improve graph shape with speculative execution
Most of the time, we don't need to have a dynamic call sub graph, since the actual function call could be represented statically as it originally was before lambda functions were implemented. Simplifying the graph shape has important performance benefits in terms of both keep the graph smaller (memory, etc) and in avoiding the need to run transactions at runtime (speed) to reshape the graph. Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
This commit is contained in:
@@ -204,8 +204,10 @@ func (obj *MapFunc) Validate() error {
|
||||
// will return correct data.
|
||||
func (obj *MapFunc) Info() *interfaces.Info {
|
||||
return &interfaces.Info{
|
||||
Pure: false, // TODO: what if the input function isn't pure?
|
||||
Pure: false, // XXX: what if the input function isn't pure?
|
||||
Memo: false,
|
||||
Fast: false,
|
||||
Spec: false,
|
||||
Sig: obj.sig(), // helper
|
||||
Err: obj.Validate(),
|
||||
}
|
||||
@@ -439,9 +441,9 @@ func (obj *MapFunc) replaceSubGraph(subgraphInput interfaces.Func) error {
|
||||
)
|
||||
obj.init.Txn.AddVertex(inputElemFunc)
|
||||
|
||||
outputElemFunc, err := obj.lastFuncValue.Call(obj.init.Txn, []interfaces.Func{inputElemFunc})
|
||||
outputElemFunc, err := obj.lastFuncValue.CallWithFuncs(obj.init.Txn, []interfaces.Func{inputElemFunc})
|
||||
if err != nil {
|
||||
return errwrap.Wrapf(err, "could not call obj.lastFuncValue.Call()")
|
||||
return errwrap.Wrapf(err, "could not call obj.lastFuncValue.CallWithFuncs()")
|
||||
}
|
||||
|
||||
obj.init.Txn.AddEdge(subgraphInput, inputElemFunc, &interfaces.FuncEdge{
|
||||
|
||||
Reference in New Issue
Block a user