ENH: Avoid memory peak and useless computations when printing a MaskedArray.
ENH: Avoid memory peak and useless computations when printing a MaskedArray.

Ref #3544.

When printing a `MaskedArray`, the whole array is converted to the object dtype,
whereas only a few values are printed to screen. So the approach here is to cut
the array and keep only a subset that it used for the string conversion. This
way the output should not change.

simongibbons/numpy,drasmuss/numpy,skwbc/numpy,pizzathief/numpy,rherault-insa/numpy,jorisvandenbossche/numpy,b-carter/numpy,pbrod/numpy,pdebuyl/numpy,drasmuss/numpy,tacaswell/numpy,solarjoe/numpy,drasmuss/numpy,SiccarPoint/numpy,charris/numpy,chatcannon/numpy,mhvk/numpy,ContinuumIO/numpy,maniteja123/numpy,seberg/numpy,jakirkham/numpy,AustereCuriosity/numpy,pizzathief/numpy,ssanderson/numpy,ahaldane/numpy,joferkington/numpy,seberg/numpy,pizzathief/numpy,b-carter/numpy,simongibbons/numpy,ddasilva/numpy,ESSS/numpy,argriffing/numpy,madphysicist/numpy,jorisvandenbossche/numpy,MSeifert04/numpy,WarrenWeckesser/numpy,kiwifb/numpy,skwbc/numpy,madphysicist/numpy,maniteja123/numpy,mhvk/numpy,jonathanunderwood/numpy,tynn/numpy,simongibbons/numpy,dwillmer/numpy,Dapid/numpy,gmcastil/numpy,endolith/numpy,rherault-insa/numpy,simongibbons/numpy,ddasilva/numpy,pbrod/numpy,Eric89GXL/numpy,seberg/numpy,seberg/numpy,ESSS/numpy,abalkin/numpy,charris/numpy,njase/numpy,Eric89GXL/numpy,dwillmer/numpy,joferkington/numpy,grlee77/numpy,abalkin/numpy,charris/numpy,stuarteberg/numpy,tacaswell/numpy,mhvk/numpy,bertrand-l/numpy,gmcastil/numpy,bertrand-l/numpy,rgommers/numpy,anntzer/numpy,numpy/numpy,pbrod/numpy,pizzathief/numpy,stuarteberg/numpy,jorisvandenbossche/numpy,pbrod/numpy,MSeifert04/numpy,mattip/numpy,joferkington/numpy,jakirkham/numpy,stuarteberg/numpy,joferkington/numpy,grlee77/numpy,anntzer/numpy,dwillmer/numpy,rgommers/numpy,ContinuumIO/numpy,numpy/numpy,WarrenWeckesser/numpy,tynn/numpy,utke1/numpy,pdebuyl/numpy,argriffing/numpy,mattip/numpy,solarjoe/numpy,chiffa/numpy,pdebuyl/numpy,dwillmer/numpy,gmcastil/numpy,endolith/numpy,ahaldane/numpy,ahaldane/numpy,nbeaver/numpy,chatcannon/numpy,jakirkham/numpy,Eric89GXL/numpy,numpy/numpy,chiffa/numpy,behzadnouri/numpy,gfyoung/numpy,shoyer/numpy,njase/numpy,AustereCuriosity/numpy,pizzathief/numpy,njase/numpy,ahaldane/numpy,behzadnouri/numpy,bertrand-l/numpy,WarrenWeckesser/numpy,anntzer/numpy,maniteja123/numpy,gfyoung/numpy,mwiebe/numpy,ahaldane/numpy,WarrenWeckesser/numpy,jakirkham/numpy,rherault-insa/numpy,grlee77/numpy,ssanderson/numpy,jonathanunderwood/numpy,stuarteberg/numpy,kiwifb/numpy,jorisvandenbossche/numpy,numpy/numpy,bringingheavendown/numpy,mwiebe/numpy,argriffing/numpy,simongibbons/numpy,gfyoung/numpy,grlee77/numpy,jakirkham/numpy,shoyer/numpy,grlee77/numpy,MSeifert04/numpy,MSeifert04/numpy,SiccarPoint/numpy,endolith/numpy,utke1/numpy,tacaswell/numpy,mhvk/numpy,charris/numpy,chatcannon/numpy,ESSS/numpy,ssanderson/numpy,solarjoe/numpy,ddasilva/numpy,anntzer/numpy,bringingheavendown/numpy,behzadnouri/numpy,madphysicist/numpy,jorisvandenbossche/numpy,MSeifert04/numpy,madphysicist/numpy,chiffa/numpy,ContinuumIO/numpy,tynn/numpy,mattip/numpy,abalkin/numpy,Dapid/numpy,AustereCuriosity/numpy,shoyer/numpy,madphysicist/numpy,Dapid/numpy,mwiebe/numpy,shoyer/numpy,utke1/numpy,skwbc/numpy,SiccarPoint/numpy,endolith/numpy,shoyer/numpy,SiccarPoint/numpy,Eric89GXL/numpy,b-carter/numpy,pbrod/numpy,bringingheavendown/numpy,nbeaver/numpy,kiwifb/numpy,mhvk/numpy,WarrenWeckesser/numpy,jonathanunderwood/numpy,rgommers/numpy,pdebuyl/numpy,nbeaver/numpy,rgommers/numpy,mattip/numpy