code: func (c *Container) optimize() {
  	if c.n == 0 {
  		statsHit("optimize/empty")
  		return
  	}
  	runs := c.countRuns()
  
  	var newType byte
  	if runs <= runMaxSize && runs <= c.n/2 {
  		newType = containerRun
  	} else if c.n < ArrayMaxSize {
  		newType = containerArray
  	} else {
  		newType = containerBitmap
  	}
  
  	// Then convert accordingly.
  	if c.isArray() {
  		if newType == containerBitmap {
  			statsHit("optimize/arrayToBitmap")
  			c.arrayToBitmap()
  		} else if newType == containerRun {
  			statsHit("optimize/arrayToRun")
  			c.arrayToRun(runs)
  		} else {
  			statsHit("optimize/arrayUnchanged")
  		}
  	} else if c.isBitmap() {
  		if newType == containerArray {
  			statsHit("optimize/bitmapToArray")
  			c.bitmapToArray()
  		} else if newType == containerRun {
  			statsHit("optimize/bitmapToRun")
  			c.bitmapToRun(runs)
  		} else {
  			statsHit("optimize/bitmapUnchanged")
  		}
  	} else if c.isRun() {
  		if newType == containerBitmap {
  			statsHit("optimize/runToBitmap")
  			c.runToBitmap()
  		} else if newType == containerArray {
  			statsHit("optimize/runToArray")
  			c.runToArray()
  		} else {
  			statsHit("optimize/runUnchanged")
  		}
  	}
  }
docs: // optimize converts the container to the type which will take up the least
  // amount of space.