2 virtual calls are required to simply get Visitor&#x27;s logic executed. But if you want your Visitor to actually do something usefull with visited object then you have to call a bunch of getters to extract the object data. This adds several more virtual calls. Pattern matching in Scala can be implemented as &quot;messing with the bytecode&quot;, bypassing getters completely, which saves you all those virtual calls to them.