I am trying to parse java files using ANTLR4 and walk the parse tree searching for specific function calls.
While I am able to achieve this using both Visitor and Listener approach, but stress tests reveals that Listeners are faster compared to Visitors, which goes contrary to popular belief.
Theoretically, Visitors are supposed to be faster as they would only inspect specific node, where as listeners inspect all. Anyone know why this would be the case?
visit...(...)
methods, all nodes will be visited. – Bart Kiers