Profiling processing of occurrences.

This commit is contained in:
Fedor Isakov 2016-06-02 11:57:12 +02:00
parent 61b488aebd
commit ab23988887
2 changed files with 7 additions and 4 deletions

View File

@ -238,7 +238,7 @@ internal class MatchTrie(val rule: Rule,
// INCONCLUSIVE may yield some (ir-)relevant results
// NONE means no results could have been found at all, so it's useless to attempt again with the same input
private fun lookupAuxOccurrences(cst: Constraint): Pair<Result, Iterable<ConstraintOccurrence>> {
return profiler.profile<Pair<Result, Iterable<ConstraintOccurrence>>> ("lookupAuxOccurrences") {
return profiler.profile<Pair<Result, Iterable<ConstraintOccurrence>>> ("lookupAux_${cst.symbol()}") {
val cache = ArrayList<ConstraintOccurrence>(4)
for (arg in cst.arguments()) {

View File

@ -14,6 +14,7 @@ import jetbrains.mps.unification.Substitution
import jetbrains.mps.unification.Term
import jetbrains.mps.unification.TermWrapper
import jetbrains.mps.unification.Unification
import org.jetbrains.kotlin.container.topologicalSort
import java.util.*
import com.github.andrewoma.dexx.collection.List as PersList
@ -29,10 +30,12 @@ class Matcher(val ruleIndex: RuleIndex,
{
private val matchTries: List<MatchTrie> by lazy(LazyThreadSafetyMode.NONE) {
ArrayList<MatchTrie>(4).apply {
profiler.profile<List<MatchTrie>>("lookupRules_${activeOcc.constraint().symbol()}") {
for(rule in ruleIndex.forOccurrence(activeOcc)) {
add(MatchTrie(rule, activeOcc, aux, profiler))
ArrayList<MatchTrie>(4).apply {
for(rule in ruleIndex.forOccurrence(activeOcc).toList()) {
add(MatchTrie(rule, activeOcc, aux, profiler))
}
}
}