Merge functions are often used with containers like Set to track things like sets of free variables or to implement aggregation (with set-contains). However, they are currently very slow for non-trivial workloads:
Both of the programs below require gigabytes of memory and never finish.
(sort IntSet (Set i64))
(relation R (i64))
(function f () IntSet :merge (set-union old new))
(R 0)
(rule
((R i) (< i 50000))
((R (+ i 1))
(set (f) (set-of i))))
(run-schedule
(saturate (run)))
(sort IntSet (Set i64))
(relation R (i64))
(function f () IntSet :merge (set-union old new))
(R 0)
(ruleset init)
(rule
((R i) (< i 50000))
((R (+ i 1)))
:ruleset init)
(rule ((R i))
((set (f) (set-of i))))
(run-schedule
(saturate (run init)
(run)))
Merge functions are often used with containers like
Setto track things like sets of free variables or to implement aggregation (withset-contains). However, they are currently very slow for non-trivial workloads:Both of the programs below require gigabytes of memory and never finish.