scala performance tweaks