Perftest Query1, functional impl