Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:04:51+00:00 2026-06-08T21:04:51+00:00

How I can compile my project with optimizations turned on and see what optimizations

  • 0

How I can compile my project with optimizations turned on and see what optimizations changed in my code.

For example:

My original code:

printf("Test: %d",52);
for (int empty=0;i<100000;i++) {
    //Nothing here
}

Now when I compile my code with optimzations ,I want to see: (I think it’ll be like that)

printf("Test: 52");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:04:53+00:00Added an answer on June 8, 2026 at 9:04 pm

    The compiler doesn’t optimize modify the source code (what you’ve shown in your question), but the binary, which consists of asm instructions.

    How you turn optimization on and off depends on the compiler, so you’ll have to refer to its documentation.

    In MSVS, you can choose this option from the top toolbar – look for Debug (un-optimized) vs Release (optimized). You can see the binary code by stepping through the code with the debugger, right click -> show dissasembly.

    Your code, for example, generates:

    Without optimizations:

        printf("Test: %d",52);
    0097171E  mov         esi,esp  
    00971720  push        34h  
    00971722  push        offset string "Test: %d" (9788C8h)  
    00971727  call        dword ptr [__imp__printf (97C3E0h)]  
    0097172D  add         esp,8  
    00971730  cmp         esi,esp  
    00971732  call        @ILT+575(__RTC_CheckEsp) (971244h)  
        for (int i=0;i<100000;i++) {
    00971737  mov         dword ptr [i],0  
    0097173E  jmp         wmain+49h (971749h)  
    00971740  mov         eax,dword ptr [i]  
    00971743  add         eax,1  
    00971746  mov         dword ptr [i],eax  
    00971749  cmp         dword ptr [i],186A0h  
    00971750  jge         wmain+54h (971754h)  
            //Nothing here
        }
    00971752  jmp         wmain+40h (971740h)  
    

    With optimizations:

        printf("Test: %d",52);
    013A1000  push        34h  
    013A1002  push        offset string "Test: %d" (13A20F4h)  
    013A1007  call        dword ptr [__imp__printf (13A209Ch)]  
    013A100D  add         esp,8  
        for (int i=0;i<100000;i++) {
            //Nothing here
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine the following folder structure: project src code.c makefile bin How can I compile
Using GCC 4.2 to compile project, very slow, from where I can see compiling
Just downloaded the Visual Studio 2010 Premium and realized that can't compile the project,
I have VS2005. How can I compile my project under specific version of .NET?
I can't compile my Android project for the Dalvik VM because of this error:
I have a multi-module project. I thought I can compile only a single module
I have multimodule project. Can I make it somehow work that when calling compile
I can't compile a project because the namespaces System.Web.UI and System.Web.Security are missing. I
GNU 23.1.1 By clicking the F5 button I can compile my project. However, I
If i make a project with XCode i can compile it to both 32bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.