Converter from Java: optimization to not instantiate visitor objects each time