Add more profiling points

This commit is contained in:
Fedor Isakov 2024-09-25 15:40:01 +02:00
parent 540ac9071f
commit 349cbade85
2 changed files with 6 additions and 4 deletions

View File

@ -36,7 +36,7 @@ fun emptyRuleBits() = BitSet()
* *
* @author Fedor Isakov * @author Fedor Isakov
*/ */
class RuleIndex(): Iterable<Rule>, RuleLookup class RuleIndex(rules: Iterable<Rule>, profiler: Profiler? = null) : Iterable<Rule>, RuleLookup
{ {
private class IndexedRule(var idx: Int, val rule: Rule) private class IndexedRule(var idx: Int, val rule: Rule)
@ -57,8 +57,10 @@ class RuleIndex(): Iterable<Rule>, RuleLookup
private val allRules = LinkedList<IndexedRule>() private val allRules = LinkedList<IndexedRule>()
constructor(rules: Iterable<Rule>) : this() { init {
buildIndexFromRules(rules) profiler.profile("build rule index") {
buildIndexFromRules(rules)
}
} }
override fun lookupRuleByTag(tag: Any): Rule? = tag2rule[tag] override fun lookupRuleByTag(tag: Any): Rule? = tag2rule[tag]

View File

@ -54,8 +54,8 @@ internal class EvaluationSessionImpl private constructor (
open inner class DefaultProcessingSession { open inner class DefaultProcessingSession {
fun getSession(): SessionData { fun getSession(): SessionData {
val ruleIndex = RuleIndex(program.rules())
val ruleIndex = RuleIndex(program.rules(), profiler)
val journal = MatchJournalImpl(trace) val journal = MatchJournalImpl(trace)
val logicalState = LogicalState() val logicalState = LogicalState()
val dispatchingFront = Dispatcher(ruleIndex).front() val dispatchingFront = Dispatcher(ruleIndex).front()