performance tuning for InMemoryAttribute (dict and sorted keys)