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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
| test.o: file format elf32-i386
Disassembly of section .text:
00000000 <_Z5test1v>:
//PrintWrapper::Ptr pw(new PrintWrapper(p, 1, 2.f,3.0f,4.0f));
Print::Ptr p = new Print();
PrintWrapper::Ptr pw = new PrintWrapper(p, 1, 2.f,3.0f,4.0f);
void test1()
{
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: 53 push ebx
4: 83 ec 24 sub esp,0x24
7: e8 fc ff ff ff call 8 <_Z5test1v+0x8>
//-------------test 1-------------------------
//auto time1 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
c: 31 db xor ebx,ebx
e: 66 90 xchg ax,ax
{
p->print(1, 2.f,3.0f,4.0f);
10: a1 00 00 00 00 mov eax,ds:0x0
{
//-------------test 1-------------------------
//auto time1 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
15: 83 c3 01 add ebx,0x1
{
p->print(1, 2.f,3.0f,4.0f);
18: 8b 10 mov edx,DWORD PTR [eax]
1a: c7 44 24 10 00 00 80 mov DWORD PTR [esp+0x10],0x40800000
21: 40
22: c7 44 24 0c 00 00 40 mov DWORD PTR [esp+0xc],0x40400000
29: 40
2a: c7 44 24 08 00 00 00 mov DWORD PTR [esp+0x8],0x40000000
31: 40
32: c7 44 24 04 01 00 00 mov DWORD PTR [esp+0x4],0x1
39: 00
3a: 89 04 24 mov DWORD PTR [esp],eax
3d: ff 12 call DWORD PTR [edx]
{
//-------------test 1-------------------------
//auto time1 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
3f: 81 fb 00 e1 f5 05 cmp ebx,0x5f5e100
45: 75 c9 jne 10 <_Z5test1v+0x10>
//auto time2 = std::chrono::system_clock::now();
//cout <<"test 1 : "<< (time2 - time1).count() << " microseconds." << endl;
}
47: 83 c4 24 add esp,0x24
4a: 5b pop ebx
4b: 5d pop ebp
4c: c3 ret
4d: 8d 76 00 lea esi,[esi+0x0]
00000050 <_Z5test2v>:
void test2()
{
50: 55 push ebp
51: 89 e5 mov ebp,esp
53: 56 push esi
54: 53 push ebx
55: 83 ec 20 sub esp,0x20
58: e8 fc ff ff ff call 59 <_Z5test2v+0x9>
//-------------test 2-------------------------
//auto time3 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
5d: 31 db xor ebx,ebx
5f: 90 nop
{
pw->execute();
60: a1 00 00 00 00 mov eax,ds:0x0
//-------------test 2-------------------------
//auto time3 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
65: 83 c3 01 add ebx,0x1
~PrintWrapper(){}
void execute()
{
m_print->print(_p1,_p2,_p3,_p4);
68: 8b 10 mov edx,DWORD PTR [eax]
6a: 8b 70 10 mov esi,DWORD PTR [eax+0x10]
6d: 8b 0a mov ecx,DWORD PTR [edx]
6f: 89 74 24 10 mov DWORD PTR [esp+0x10],esi
73: 8b 70 0c mov esi,DWORD PTR [eax+0xc]
76: 89 74 24 0c mov DWORD PTR [esp+0xc],esi
7a: 8b 70 08 mov esi,DWORD PTR [eax+0x8]
7d: 89 74 24 08 mov DWORD PTR [esp+0x8],esi
81: 8b 40 04 mov eax,DWORD PTR [eax+0x4]
84: 89 14 24 mov DWORD PTR [esp],edx
87: 89 44 24 04 mov DWORD PTR [esp+0x4],eax
8b: ff 11 call DWORD PTR [ecx]
//-------------test 2-------------------------
//auto time3 = std::chrono::system_clock::now();
for (auto var = 0; var < ITER; ++var)
8d: 81 fb 00 e1 f5 05 cmp ebx,0x5f5e100
93: 75 cb jne 60 <_Z5test2v+0x10>
//auto time4 = std::chrono::system_clock::now();
//cout <<"test 2 : "<< (time4 - time3).count() << " microseconds." << endl;
}
95: 83 c4 20 add esp,0x20
98: 5b pop ebx
99: 5e pop esi
9a: 5d pop ebp
9b: c3 ret
9c: 8d 74 26 00 lea esi,[esi+eiz*1+0x0]
000000a0 <main>:
int main() { test1(); test2();}
a0: 55 push ebp
a1: 89 e5 mov ebp,esp
a3: 83 e4 f0 and esp,0xfffffff0
a6: e8 fc ff ff ff call a7 <main+0x7>
ab: e8 fc ff ff ff call ac <main+0xc>
b0: e8 fc ff ff ff call b1 <main+0x11>
b5: 31 c0 xor eax,eax
b7: 89 ec mov esp,ebp
b9: 5d pop ebp
ba: c3 ret
bb: 90 nop
bc: 8d 74 26 00 lea esi,[esi+eiz*1+0x0]
000000c0 <_GLOBAL__I_p>:
c0: 55 push ebp
c1: 89 e5 mov ebp,esp
c3: 83 ec 18 sub esp,0x18
c6: e8 fc ff ff ff call c7 <_GLOBAL__I_p+0x7>
extern wostream wclog; ///< Linked to standard error (buffered)
#endif
//@}
// For construction of filebuffers for cout, cin, cerr, clog et. al.
static ios_base::Init __ioinit;
cb: c7 04 24 08 00 00 00 mov DWORD PTR [esp],0x8
d2: e8 fc ff ff ff call d3 <_GLOBAL__I_p+0x13>
d7: c7 44 24 08 00 00 00 mov DWORD PTR [esp+0x8],0x0
de: 00
df: c7 44 24 04 08 00 00 mov DWORD PTR [esp+0x4],0x8
e6: 00
e7: c7 04 24 00 00 00 00 mov DWORD PTR [esp],0x0
ee: e8 fc ff ff ff call ef <_GLOBAL__I_p+0x2f>
};
//Print::Ptr p(new Print());
//PrintWrapper::Ptr pw(new PrintWrapper(p, 1, 2.f,3.0f,4.0f));
Print::Ptr p = new Print();
f3: c7 04 24 04 00 00 00 mov DWORD PTR [esp],0x4
fa: e8 fc ff ff ff call fb <_GLOBAL__I_p+0x3b>
#include <vector>
using namespace std;
#define ITER 100000000
class Print{
ff: c7 00 08 00 00 00 mov DWORD PTR [eax],0x8
};
//Print::Ptr p(new Print());
//PrintWrapper::Ptr pw(new PrintWrapper(p, 1, 2.f,3.0f,4.0f));
Print::Ptr p = new Print();
PrintWrapper::Ptr pw = new PrintWrapper(p, 1, 2.f,3.0f,4.0f);
105: c7 04 24 14 00 00 00 mov DWORD PTR [esp],0x14
};
//Print::Ptr p(new Print());
//PrintWrapper::Ptr pw(new PrintWrapper(p, 1, 2.f,3.0f,4.0f));
Print::Ptr p = new Print();
10c: a3 00 00 00 00 mov ds:0x0,eax
PrintWrapper::Ptr pw = new PrintWrapper(p, 1, 2.f,3.0f,4.0f);
111: e8 fc ff ff ff call 112 <_GLOBAL__I_p+0x52>
//typedef shared_ptr<PrintWrapper> Ptr;
typedef PrintWrapper* Ptr;
PrintWrapper(Print::Ptr print, int p1, float p2, float p3, float p4) :
m_print(print), _p1(p1),_p2(p2),_p3(p3),_p4(p4){}
116: 8b 15 00 00 00 00 mov edx,DWORD PTR ds:0x0
11c: c7 40 04 01 00 00 00 mov DWORD PTR [eax+0x4],0x1
123: 89 10 mov DWORD PTR [eax],edx
125: c7 40 08 00 00 00 40 mov DWORD PTR [eax+0x8],0x40000000
12c: c7 40 0c 00 00 40 40 mov DWORD PTR [eax+0xc],0x40400000
133: c7 40 10 00 00 80 40 mov DWORD PTR [eax+0x10],0x40800000
};
//Print::Ptr p(new Print());
//PrintWrapper::Ptr pw(new PrintWrapper(p, 1, 2.f,3.0f,4.0f));
Print::Ptr p = new Print();
PrintWrapper::Ptr pw = new PrintWrapper(p, 1, 2.f,3.0f,4.0f);
13a: a3 00 00 00 00 mov ds:0x0,eax
//auto time4 = std::chrono::system_clock::now();
//cout <<"test 2 : "<< (time4 - time3).count() << " microseconds." << endl;
}
int main() { test1(); test2();}
13f: c9 leave
140: c3 ret
Disassembly of section .text._ZN5Print5printEifff:
00000000 <_ZN5Print5printEifff>:
public:
//typedef shared_ptr<Print> Ptr;
typedef Print* Ptr;
virtual void print(int p1, float p2, float p3, float p4){/*print */}
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: e8 fc ff ff ff call 4 <_ZN5Print5printEifff+0x4>
8: 5d pop ebp
9: c3 ret |
Partager