STL set.h Performance Analysis
-
I am looking how to measure the performance of the set.h file in the Standard Template Library. This is for a homework assignment. We are required to modify the set.h file with global integer variables to do the following: I need to know how to count the number of compares and data moves that take place when loading N number of strings into a set or multiset. I tried to open up the set.h and increment counters in a few places, but I have no idea which functions do what. The set.h file is very confusing to me. Any help is appreciated.
-
I am looking how to measure the performance of the set.h file in the Standard Template Library. This is for a homework assignment. We are required to modify the set.h file with global integer variables to do the following: I need to know how to count the number of compares and data moves that take place when loading N number of strings into a set or multiset. I tried to open up the set.h and increment counters in a few places, but I have no idea which functions do what. The set.h file is very confusing to me. Any help is appreciated.
Why not use the contained object instead? Just overload constructors and the relevant operators. And if the paths that I have followed/have tread against the flow/there is no need for sorrow I am coming home Return, Crüxshadows
-
I am looking how to measure the performance of the set.h file in the Standard Template Library. This is for a homework assignment. We are required to modify the set.h file with global integer variables to do the following: I need to know how to count the number of compares and data moves that take place when loading N number of strings into a set or multiset. I tried to open up the set.h and increment counters in a few places, but I have no idea which functions do what. The set.h file is very confusing to me. Any help is appreciated.
As they always say "kids, dont try this at home". Or better, dont try this with the set which shipped with VC6. Take the STLport (stlport.org[^]), its much more readable and is still a compatible implementation.
Finally moved to Brazil
-
As they always say "kids, dont try this at home". Or better, dont try this with the set which shipped with VC6. Take the STLport (stlport.org[^]), its much more readable and is still a compatible implementation.
Finally moved to Brazil
I wasn't modifying the original set.h file. I made a copy an placed it in my project file. I simply linked to it absolutely. Thanks for the other resource tho! Is there a set.h (or similar header file) included in that implimentation? If it is more readable, it will definitely help. Thanks, Brian
-
I wasn't modifying the original set.h file. I made a copy an placed it in my project file. I simply linked to it absolutely. Thanks for the other resource tho! Is there a set.h (or similar header file) included in that implimentation? If it is more readable, it will definitely help. Thanks, Brian
BrianReeve wrote: I wasn't modifying the original set.h file Actually I was referring to trying to understand not to modifying the file. BrianReeve wrote: Is there a set.h (or similar header file) included in that implimentation? You bet there is: <set>
Finally moved to Brazil
-
I am looking how to measure the performance of the set.h file in the Standard Template Library. This is for a homework assignment. We are required to modify the set.h file with global integer variables to do the following: I need to know how to count the number of compares and data moves that take place when loading N number of strings into a set or multiset. I tried to open up the set.h and increment counters in a few places, but I have no idea which functions do what. The set.h file is very confusing to me. Any help is appreciated.
You can get these estimates without modifying the source code of
std::set
. In order to count copying and compare operations, enrich the class you're using as element in the set like follows:class element_set
{
public:
static unsigned no_of_copying_ops;
static unsigned no_of_compare_ops;element_set(const element_set& x)
{
++unsigned no_of_copying_ops;
...
}bool operator<(const element_set& x)const
{
++no_of_compare_ops;
...
}...
};unsigned element_set::no_of_copying_ops=0;
unsigned element_set::no_of_compare_ops=0;Hope this helps, good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo