oracle-samples/clara-rules

Clara rules and queries with pre-compiled LHS nodes and RHS

Closed this issue · 3 comments

I'm thinking of doing some work for having clara rules and queries defined perhaps through a slightly different defquery/defrule macro which pre-compiles the productions; this would potentially benefit JavaScript and GraalVM environments where the session's expressions cannot be eval'd at runtime. This would be a relatively sizable enhancement/project, would appreciate discussing it further to work through the potential problems I might encounter.

Off the top of my head, i'd be concerned with the overhead of additional compiled functions that previously were considered common. For example, rules that share a common alpha node that might be shared across several rules.

In the compilation phase today, we attempt to share common nodes then compile the associated functions after the fact.

My concern being, that larger Sessions today already have the hallmark of generating too many classes to be considered sustainable. Sustainable in the sense that we have seen issues where the Compressed class space on the JVM can and will exceed the default bounds.

Thanks for the explanation, that makes a lot of sense if we're reducing the set of compiled nodes to the common expressions across all productions. I'll do my experimentation with GraalVM for now then using defsession, I know I have gotten it to work before so it should be possible, but would like to come up with a easy to use template/approach.

@k13gomez I think this is interesting in that it relates to my issues I've had with the CLJS impl of clara-rules.
Relates to #388

I was needing to rewrite the clara compiler quite a bit to get it where I think it really needs to be - this relates to defsession too. I can't recall if I put enough details in that issue about what I found, but can follow-up.