Created
April 5, 2018 08:11
-
-
Save emirozturk/bf8522ffa86bd3c7344a3335dc4658f4 to your computer and use it in GitHub Desktop.
NYP 5. Hafta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
using namespace std; | |
void fonk1(string deger) { | |
} | |
void fonk2(string °er) { | |
} | |
int main() | |
{ | |
chrono::steady_clock::time_point begin; | |
chrono::steady_clock::time_point end; | |
for (int miktar = 0; miktar < 10000000; miktar += 1000000) | |
{ | |
string x = ""; | |
for (int i = 0; i < miktar; i++) | |
x.append("a"); | |
cout << "uzunluk:" << x.length() << endl; | |
begin = std::chrono::steady_clock::now(); | |
fonk1(x); | |
end = std::chrono::steady_clock::now(); | |
long long deger = chrono::duration_cast<chrono::nanoseconds> (end - begin).count(); | |
begin = std::chrono::steady_clock::now(); | |
fonk2(x); | |
end = std::chrono::steady_clock::now(); | |
long long ref = chrono::duration_cast<chrono::nanoseconds> (end - begin).count(); | |
if (ref == 0)ref = 1; | |
cout << "Miktar:" << miktar << " Fark:" << deger / ref << " kat" << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment