Welcome lazy generators! recursive generators are now orders of magnitude faster, ping @adam678
(time
(let [schema [:schema {:registry {::A [:tuple [:= :A]]
::B [:tuple [:= :B]]
::C [:tuple [:= :C]]
::D [:tuple [:= :D]]
::E [:tuple [:= :E] [:ref ::item]]
::F [:tuple [:= :F] [:ref ::item]]
::G [:tuple [:= :G] [:ref ::item]]
::item [:multi {:dispatch first}
[:A ::A]
[:B ::B]
[:C ::C]
[:D ::D]
[:E ::E]
[:F ::F]
[:G ::G]]}}
::E]
valid? (m/validator schema)]
(is (every? valid? (mg/sample schema {:size 10000})))))
; => "Elapsed time: 230 msecs"
That was fast! Just tested it with my real world example and it seems to work just perfectly. (Generating WASM instructions where an instruction may contain a list of instructions). Thanks a lot!