-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (48 loc) · 1.26 KB
/
main.cpp
File metadata and controls
56 lines (48 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <chrono>
#include <iostream>
#include <matrix4x4.h>
#define itemCount (20000000)
using namespace std;
using namespace std::chrono;
void testMy()
{
srand(0);
high_resolution_clock::time_point t1 = high_resolution_clock::now();
matrix4x4* out=new matrix4x4[itemCount];
matrix4x4 a;
out[0].randInit();
a.identInit();
for(size_t i=1;i<itemCount;i++)
{
out[i]=a*out[i-1];
}
high_resolution_clock::time_point t2 = high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();
std::cout<< duration <<std::endl;
out[itemCount-1].print();
delete[] out;
}
void testAuthor()
{
srand(0);
high_resolution_clock::time_point t1 = high_resolution_clock::now();
amatrix4x4 a;
amatrix4x4* out=new amatrix4x4[itemCount];
out[0].randInit();
a.identInit();
for(size_t i=1;i<itemCount;i++)
{
out[i]=a*out[i-1];
}
high_resolution_clock::time_point t2 = high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();
std::cout<< duration <<std::endl;
out[itemCount-1].print();
delete[] out;
}
int main()
{
testMy();
testAuthor();
return 0;
}