Use os.scandir() in benchmark if available