Optimize reduce for maps

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>