Faster type lookup and scalar string caching for type2xxx.