Improve performance in scala test