Skip to content

Instantly share code, notes, and snippets.

@SahilPatidar
Last active October 9, 2024 07:17
Show Gist options
  • Save SahilPatidar/1df9e219d0f8348bd126f1e01658b3fa to your computer and use it in GitHub Desktop.
Save SahilPatidar/1df9e219d0f8348bd126f1e01658b3fa to your computer and use it in GitHub Desktop.

Matrices Test:

clang-repl> %lib testb/matrix.dylib
clang-repl> #include<vector>
clang-repl> extern "C++" std::vector<std::vector<int> > getMatrices(int r, int c);
clang-repl> extern "C++" void print_mt(std::vector<std::vector<int> > &result);                                                   
clang-repl> extern "C++" std::vector<std::vector<int> > multiplyMatrices(const std::vector<std::vector<int> > &A, const std::vector<std::vector<int> > &B);
clang-repl> std::vector<std::vector<int>> A = getMatrices(1000, 1000);
clang-repl> std::vector<std::vector<int>> B = getMatrices(1000, 1000);
clang-repl> std::vector<std::vector<int>> R = multiplyMatrices(A,B);
clang-repl> print_mt(R);

1. Out-of-Process Execution:

Run User Time (s) System Time (s) User+System Time (s) Wall Time (s) Instructions
1 0.5188 0.0603 0.5791 11.0334 2,516,397,223
2 0.5214 0.0631 0.5845 11.0326 2,512,912,733
3 0.5166 0.0627 0.5793 11.0381 2,515,101,465
4 0.5127 0.0577 0.5704 11.0251 2,508,491,374
5 0.5175 0.0581 0.5756 10.9966 2,508,877,342
6 0.5107 0.0691 0.5799 11.0376 2,527,632,636
7 0.5269 0.0665 0.5934 11.0460 2,510,249,453

2. In-Process Execution:

Run User Time (s) System Time (s) User+System Time (s) Wall Time (s) Instructions
1 10.6521 0.1080 10.7601 10.8756 103,249,829,021
2 10.6698 0.1362 10.8060 11.0683 103,325,663,593
3 10.6713 0.1172 10.7885 10.9877 103,275,929,785
4 10.6589 0.1016 10.7606 10.8746 103,245,824,627
5 10.5842 0.1102 10.6944 10.8944 103,270,635,365
6 10.6599 0.1162 10.7760 10.9926 103,277,204,415
7 10.6590 0.1152 10.7742 10.8890 103,223,043,598

Comparative Analysis (Out-of-Process vs In-Process):

Metric In-Process Execution Out-Of-Process Execution
Min User+System Time (s) 10.6944 0.5704
Max User+System Time (s) 10.8060 0.5934
Average User+System Time (s) 10.7657 0.5803
Min Wall Time (s) 10.8746 10.9966
Max Wall Time (s) 11.0683 11.0460
Average Wall Time (s) 10.9403 11.0299
Min Instructions 103,223,043,598 2,508,491,374
Max Instructions 103,325,663,593 2,527,632,636
Average Instructions 1,03,26,68,75,772 2,51,42,37,460

Graphical Representation of Results:

Execution Time:

matrix1

Wall Time:

matrix2

Instruction Count:

matrix3


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment