Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- #include <string>
- #include <cstring>
- #include <ctime>
- #include <iostream>
- #include <chrono>
- long long timestamp()
- {
- return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
- }
- char text_c[10000][128];
- typedef std::unordered_map<int, std::string> text_u;
- int main() {
- std::cout << "Inicio" << std::endl;
- text_u Text_u;
- int timea = timestamp();
- for(int x=0; x!=10000; x++) {
- strcpy(text_c[x],"Era uma vez...");
- }
- std::cout << "tempo " << timestamp()-timea << std::endl;
- int timeb = timestamp();
- for(int x=0; x!=10000; x++) {
- Text_u.insert(text_u::value_type(x,"Era uma vez..."));
- }
- std::cout << "tempo " << timestamp()-timeb << std::endl;
- char texto[128];
- int time1 = timestamp();
- for(int x=0; x!=10000; x++) {
- strcpy(texto,text_c[x]);
- }
- std::cout << "tempo " << timestamp()-time1 << std::endl;
- int time2 = timestamp();
- for(int x=0; x!=10000; x++) {
- text_u::iterator j = Text_u.find(x);
- strcpy(texto,(j->second).c_str());
- }
- std::cout << "tempo " << timestamp()-time2 << std::endl;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement