Speedup algorithm used by submodel_names
Speedup algorithm used by submodel_names

I profiled some code looking for ways to speed up modeling and saw
that a good chunk of time was spent in submodel_names. To speed it up,
I rewrote the code to use a new algorithm that only makes one pass
over the list of names.

mhvk/astropy,dhomeier/astropy,mhvk/astropy,saimn/astropy,bsipocz/astropy,larrybradley/astropy,StuartLittlefair/astropy,DougBurke/astropy,dhomeier/astropy,lpsinger/astropy,MSeifert04/astropy,astropy/astropy,lpsinger/astropy,funbaker/astropy,MSeifert04/astropy,larrybradley/astropy,larrybradley/astropy,lpsinger/astropy,MSeifert04/astropy,astropy/astropy,MSeifert04/astropy,kelle/astropy,AustereCuriosity/astropy,pllim/astropy,dhomeier/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy,AustereCuriosity/astropy,aleksandr-bakanov/astropy,bsipocz/astropy,saimn/astropy,stargaser/astropy,StuartLittlefair/astropy,mhvk/astropy,lpsinger/astropy,funbaker/astropy,lpsinger/astropy,pllim/astropy,DougBurke/astropy,dhomeier/astropy,astropy/astropy,stargaser/astropy,aleksandr-bakanov/astropy,AustereCuriosity/astropy,pllim/astropy,DougBurke/astropy,stargaser/astropy,kelle/astropy,kelle/astropy,bsipocz/astropy,saimn/astropy,astropy/astropy,astropy/astropy,StuartLittlefair/astropy,stargaser/astropy,pllim/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,pllim/astropy,mhvk/astropy,saimn/astropy,mhvk/astropy,bsipocz/astropy,larrybradley/astropy,funbaker/astropy,kelle/astropy,aleksandr-bakanov/astropy,DougBurke/astropy,kelle/astropy,larrybradley/astropy,saimn/astropy,funbaker/astropy,StuartLittlefair/astropy,AustereCuriosity/astropy