Various performance tweaks; no functional changes.