00001 #include <boost/date_time/posix_time/posix_time_types.hpp> 00002 #include <list> 00003 #include <vector> 00004 #include <cstdio> 00005 #include <megatree/long_id.h> 00006 #include <megatree/tree_functions.h> 00007 00008 00009 using namespace megatree; 00010 00011 00012 const unsigned size = 100000000; 00013 int main() 00014 { 00015 boost::posix_time::ptime started, finished; 00016 00017 /* 00018 std::list<int> l; 00019 std::vector<int> res; 00020 res.reserve(size); 00021 for (unsigned i=0; i<size; i++) 00022 l.push_back(3); 00023 00024 00025 started = boost::posix_time::microsec_clock::universal_time(); 00026 for (std::list<int>::iterator it=l.begin(); it != l.end(); it++) 00027 { 00028 res.push_back(*it); 00029 } 00030 00031 finished = boost::posix_time::microsec_clock::universal_time(); 00032 printf("Looped through list of size %d in %.3f seconds\n", size, 00033 (finished - started).total_milliseconds() / 1000.0f); 00034 00035 00036 IdType id(0153422736352435267); 00037 started = boost::posix_time::microsec_clock::universal_time(); 00038 for (unsigned i=0; i<size; i++) 00039 { 00040 IdType tmp = getFileId(id, 1, 6); 00041 } 00042 finished = boost::posix_time::microsec_clock::universal_time(); 00043 printf("Get file id %d times took %.3f seconds\n", size, 00044 (finished - started).total_milliseconds() / 1000.0f); 00045 00046 */ 00047 }