rewrite get_base_name with compact recursion for performance
remove _base_units_cache since computing it is faster
rewrite get_dimensionality with compact recursion for performance
bin prefix by first character for faster lookups