testing: add AllocsPerRun

This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.

Fixes issue 4461.

R=minux.ma, rsc
CC=golang-dev
https://codereview.appspot.com/7002055

Committer: Russ Cox <rsc@golang.org>