> I can confirm that this is indeed the cause of the problem. Without any > patches applied, changing the hash_map to std::map as suggested changes the > regression stats slightly. Hence, the order is of importance. > > I will post a patch with only this change, and then eventually also update to > the statistics on committing this patch. (An alternative would be to have > e.g. a vector next to the hash_map holding the keys in a well-defined order.)
How often does this traversal happen? Is the key something that can be sorted on in a stable manner? Frequent, Yes -> Use a std::map Infrequent, Yes -> Use the hash map, but generate a sorted list whenever you need the traversal. It has to be a really infrequent traversal though for this to perform better than a map. *, No -> Use a hash_map + std::list based on insertion order (hold an iterator in the hash map so it's easy to remove from the list.) Nate _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
