JavaScript performance tweaks. [ci skip]