If you have a large number of patterns and you find that the incremental query evaluation seems very slow or uses more memory than expected, it is useful to take an instance model where the issue occurs and evaluate the footprint of each pattern independently. Of course, patterns that call other patterns will also incorporate the footprint of those patterns, but the difference can be seen nonetheless.
We provide a simple JUnit test for performing this hotspot evaluation easily using the Testing Framework of VIATRA Query: QueryPerformanceTest.xtend
Read the JavaDoc for more details, while an example on its usage can be found here for our UML surrogate queries: UMLSurrogateQueryPerformanceTest.java
Note that if you run the test and use the YourKit profiler (thanks for supporting us again!), the problematic patterns can be easily identified by looking at the heap size graphs, selecting the exceeding parts and looking at the current trace to see which query is being built.