Fork me on GitHub
#clara
<
2018-11-14
>
nlessa13:11:05

Hi, I am having performance problems in my set of rules. Probably some of the rules are performing bad. Is there any way to profile the time spent by each rule when firing-rules in a session? I couldn't find any obvious way to get this info using the inspect api.

wparker14:11:36

The inspect api is targeted at understanding the end result of the rules, not performance. For performance problems you’ll probably want a profiler or perhaps tracing. Tracing shows all the internal steps of the rules engine, and can produce a lot of data that is probably best sorted through with the REPL rather than manual inspection, but if a single rule is constantly re-firing it can make that clear. I’d probably start with a profiler though. Another approach could be to take separate parts of your use-case and see if you can find a simple subset with the perf problem, particularly one you can share that would be easier for someone else to look at.

wparker14:11:58

Are you on Clojure or ClojureScript?

nlessa14:11:25

Thanks, @wparker! Clojure.

mikerod16:11:21

@nlessa and feel free to share profiler sample results with me (or anyone interested) (with anything propriety removes). Sometimes just seeing the Clara internals in a profiling snapshot can help point someone in the right direction. Not always though.