How can I compare the performance of C ++ code?

I am starting to seriously study algorithms and data structures and am interested in how to compare the performance of different ways of implementing A & DT.

For simple tests, I can get the time before / after something starts up, run this thing 10 ^ 5 times and compare the runtime. I can parameterize input by size, or random random input, and get a list of working times and input sizes. I can output this as a csv file and pass it to pandas.

I am not sure that there are no reservations. I am also not sure what to do with the measurement of cosmic complexity.

I am learning a C ++ program. Are there any human tools to achieve what I'm trying to do?

+4
source share
3

( ). profiling , ..

Linux . (1), ( 7), perf (1), gprof ( 1), pmap (1), mallinfo ( 3) proc (5) GCC.

. . , (, ).

, . . CppCon 2017: Matt Godbolt talk ?

+4

. , , Google. , . , Big O ( ). Google, . , , .

CppCon 2015: Chandler Carruth " ++: , ! Oh My!" . , ( Google)

+4

, ++ , Intel Pin, perf tool. . , IPC/CPI, . , - . .

, , . , , , , .

, , , 2 . , 100 000 "X", 200 000 "Y". Y-X. , , , .

, 10 . , , , ( ), . , , , .

, , "" " " . , , , . , . , , . .

+4

Source: https://habr.com/ru/post/1694279/


All Articles