Use the cache in get_base_units and get_dimensionality. Added benchmarks.