U
U
Username2016-04-03 19:50:15
C++ / C#
Username, 2016-04-03 19:50:15

How to assemble c++ code in Visual Studio 2015 in size and speed?

Good afternoon, how to translate into assembler code in size and speed using the bubble algorithm as an example? And what are the fundamental differences in the assembler code between size and speed optimization?

#include <iostream>
using namespace std;

int length, a[100];
void bubble_sort() {
  for (int i = 0; i < length-1; i++) {
    for (int j = 0; j < length-i-1; j++) {
      if (a[j] > a[j+1]) {
        int b = a[j]; //change for elements
        a[j] = a[j+1];
        a[j+1] = b;
      }
    }
  }
}
 
int main() {
  cin >> length;
  for (int i = 0; i < length; i++) {
    cin >> a[i];
  }
  bubble_sort();
  for (int i = 0; i < length; i++) {
    cout << a[i] << " ";
  }
  return 0;
}

I did it in the following way: VisualC - project properties->C/C++->Output files->assembler output)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question